YetAnotherCoupler 3.2.0_a
Loading...
Searching...
No Matches
interp_stack_config.c
Go to the documentation of this file.
1// Copyright (c) 2024 The YAC Authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifdef HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include <math.h>
10#include <string.h>
11
12#include "geometry.h"
13#include "yac_mpi_internal.h"
14#include "interp_stack_config.h"
15
17 // - every interpolation type needs to have the entry type as first
18 // entry in order to be able to compare them using memcmp
19 // - no pointers are allowed here in order to be comparable
20 struct {
23 struct {
28 struct {
33 struct {
35 int order;
37 int partial_coverage;
40 struct {
49 struct {
52 struct {
58 struct {
60 double value;
62 struct {
67 struct {
71 struct {
75 struct {
80};
81
86
88 struct yac_interp_stack_config * interp_stack) {
89
90 struct yac_interp_stack_config * interp_stack_copy =
91 xmalloc(1 * sizeof(*interp_stack_copy));
92 interp_stack_copy->size = interp_stack->size;
93 interp_stack_copy->config =
94 xmalloc(interp_stack_copy->size * sizeof(*(interp_stack_copy->config)));
95 memcpy(
96 interp_stack_copy->config, interp_stack->config,
97 interp_stack_copy->size * sizeof(*(interp_stack_copy->config)));
98 return interp_stack_copy;
99}
100
101static void inline check_interpolation_type(
102 enum yac_interpolation_list type, char const * routine) {
103
105 (type == YAC_AVERAGE) ||
108 (type == YAC_CONSERVATIVE) ||
110 (type == YAC_FIXED_VALUE) ||
112 (type == YAC_USER_FILE) ||
113 (type == YAC_CHECK) ||
114 (type == YAC_CREEP) ||
115 (type == YAC_USER_CALLBACK) ||
117 (type == YAC_UNDEFINED),
118 "ERROR(%s): invalid interpolation type", routine)
119}
120
122 void const * a_, void const * b_) {
123
124 union yac_interp_stack_config_entry const * a =
125 (union yac_interp_stack_config_entry const *)a_;
126 union yac_interp_stack_config_entry const * b =
127 (union yac_interp_stack_config_entry const *)b_;
128
130 a->general.type, "yac_interp_stack_config_entry_compare");
132 b->general.type, "yac_interp_stack_config_entry_compare");
135 "ERROR(yac_interp_stack_config_entry_compare): "
136 "interpolation type is undefined");
137
138 if (a->general.type != b->general.type)
139 return (a->general.type > b->general.type) -
140 (a->general.type < b->general.type);
141
142 switch(a->general.type) {
143 default:
145 return 0;
146 case (YAC_AVERAGE): {
152 }
154 case (YAC_N_NEAREST_NEIGHBOR): {
155 if (a->n_nearest_neighbor.config.n !=
157 return (a->n_nearest_neighbor.config.n >
163 return (a->n_nearest_neighbor.config.type >
167 switch (a->n_nearest_neighbor.config.type) {
173 case (YAC_INTERP_NNN_RBF):
178 default:
179 return 0;
180 };
181 }
182 case (YAC_CONSERVATIVE): {
183 if (a->conservative.order !=
185 return (a->conservative.order >
186 b->conservative.order) -
187 (a->conservative.order <
191 return (a->conservative.enforced_conserv >
197 return (a->conservative.partial_coverage >
201 return (a->conservative.normalisation >
205 }
207 if (fabs(a->spmap.spread_distance -
209 return (a->spmap.spread_distance >
213 if (fabs(a->spmap.max_search_distance -
215 return (a->spmap.max_search_distance >
219 if (a->spmap.weight_type != b->spmap.weight_type)
220 return (a->spmap.weight_type >
221 b->spmap.weight_type) -
222 (a->spmap.weight_type <
223 b->spmap.weight_type);
224 if (a->spmap.scale_type != b->spmap.scale_type)
225 return (a->spmap.scale_type >
226 b->spmap.scale_type) -
227 (a->spmap.scale_type <
228 b->spmap.scale_type);
230 return (a->spmap.src_sphere_radius >
234 return (a->spmap.tgt_sphere_radius >
238 }
239 case (YAC_FIXED_VALUE): {
240 return (a->fixed.value >
241 b->fixed.value) -
242 (a->fixed.value <
243 b->fixed.value);
244 }
245 case (YAC_USER_FILE): {
246 int ret;
247 if ((ret = strcmp(a->user_file.filename, b->user_file.filename)))
248 return ret;
249 if ((ret = strcmp(a->user_file.src_grid_name, b->user_file.src_grid_name)))
250 return ret;
251 return strcmp(a->user_file.tgt_grid_name, b->user_file.tgt_grid_name);
252 }
253 case (YAC_CHECK): {
254 int ret;
255 if ((ret = strncmp(a->check.constructor_key, b->check.constructor_key,
256 sizeof(a->check.constructor_key)))) return ret;
257 return
258 strncmp(
260 sizeof(a->check.do_search_key));
261 };
262 case (YAC_CREEP): {
263 return
266 }
267 case (YAC_USER_CALLBACK): {
270 }
282 }
283 };
284}
285
286int yac_interp_stack_config_compare(void const * a_, void const * b_) {
287
288 struct yac_interp_stack_config const * a =
289 (struct yac_interp_stack_config const *)a_;
290 struct yac_interp_stack_config const * b =
291 (struct yac_interp_stack_config const *)b_;
292
293 int ret;
294 if ((ret = (a->size > b->size) - (a->size < b->size))) return ret;
295
296 size_t stack_size = a->size;
297 for (size_t method_idx = 0; method_idx < stack_size; ++method_idx)
298 if ((ret =
300 &(a->config[method_idx]), &(b->config[method_idx]))))
301 return ret;
302 return 0;
303}
304
306 struct yac_interp_stack_config * interp_stack) {
307
308 size_t interp_stack_size = interp_stack->size;
309 struct interp_method ** method_stack =
310 xmalloc((interp_stack_size + 1) * sizeof(*method_stack));
311 method_stack[interp_stack_size] = NULL;
312
313 for (size_t i = 0; i < interp_stack_size; ++i) {
314
316 interp_stack->config[i].general.type, "yac_interp_stack_config_generate");
318 interp_stack->config[i].general.type != YAC_UNDEFINED,
319 "ERROR(yac_interp_stack_config_generate): "
320 "unsupported interpolation method")
321 switch((int)(interp_stack->config[i].general.type)) {
322 default:
323 case(YAC_AVERAGE): {
324 enum yac_interp_avg_weight_type weight_type =
325 interp_stack->config[i].average.reduction_type;
326 int partial_coverage =
327 (int)interp_stack->config[i].average.partial_coverage;
328 method_stack[i] =
329 yac_interp_method_avg_new(weight_type, partial_coverage);
330 break;
331 }
332 case(YAC_CONSERVATIVE): {
333 int order =
334 interp_stack->config[i].conservative.order;
335 int enforced_conserv =
336 interp_stack->config[i].conservative.enforced_conserv;
337 int partial_coverage =
338 interp_stack->config[i].conservative.partial_coverage;
339 enum yac_interp_method_conserv_normalisation normalisation =
340 interp_stack->config[i].conservative.normalisation;
341
342 method_stack[i] =
344 order, enforced_conserv, partial_coverage, normalisation);
345 break;
346 }
347 case(YAC_FIXED_VALUE): {
348 double fixed_value =
349 interp_stack->config[i].fixed.value;
350 method_stack[i] = yac_interp_method_fixed_new(fixed_value);
351 break;
352 }
353 case(YAC_USER_FILE): {
354 char const * weight_file_name =
355 interp_stack->config[i].user_file.filename;
356 char const * src_grid_name =
357 interp_stack->config[i].user_file.src_grid_name;
358 char const * tgt_grid_name =
359 interp_stack->config[i].user_file.tgt_grid_name;
360 method_stack[i] =
362 weight_file_name, src_grid_name, tgt_grid_name);
363 break;
364 }
365 case(YAC_CHECK): {
366 func_constructor constructor_callback;
367 void * constructor_user_data;
369 void * do_search_user_data;
370
372 interp_stack->config[i].check.constructor_key,
373 &constructor_callback, &constructor_user_data);
375 interp_stack->config[i].check.do_search_key,
376 &do_search_callback, &do_search_user_data);
377
378 method_stack[i] =
380 constructor_callback, constructor_user_data,
381 do_search_callback, do_search_user_data);
382 break;
383 }
384 case (YAC_N_NEAREST_NEIGHBOR): {
385 method_stack[i] =
387 interp_stack->config[i].
388 n_nearest_neighbor.config);
389 break;
390 }
391 case (YAC_BERNSTEIN_BEZIER): {
392 method_stack[i] =
394 break;
395 }
397 method_stack[i] =
399 interp_stack->config[i].
400 radial_basis_function.config);
401 break;
402 }
404 method_stack[i] =
406 interp_stack->config[i].spmap.spread_distance,
407 interp_stack->config[i].spmap.max_search_distance,
408 interp_stack->config[i].spmap.weight_type,
409 interp_stack->config[i].spmap.scale_type,
410 interp_stack->config[i].spmap.src_sphere_radius,
411 interp_stack->config[i].spmap.tgt_sphere_radius);
412 break;
413 }
414 case (YAC_CREEP): {
415 method_stack[i] =
417 interp_stack->config[i].creep.creep_distance);
418 break;
419 }
420 case(YAC_USER_CALLBACK): {
421 yac_func_compute_weights compute_weights_callback;
422 void * user_data;
425 &compute_weights_callback, &user_data);
426
427 method_stack[i] =
428 yac_interp_method_callback_new(compute_weights_callback, user_data);
429 break;
430 }
432 method_stack[i] =
434 interp_stack->config[i].nearest_corner_cells.weight_type,
436 break;
437 }
438 };
439 }
440
441 return method_stack;
442}
443
445 char const * string, MPI_Comm comm) {
446
447 int strlen_pack_size, string_pack_size;
448 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &strlen_pack_size), comm);
449
451 string != NULL, "ERROR(yac_interp_stack_config_get_string_pack_size): "
452 "string is NULL");
453
455 MPI_Pack_size(
456 (int)(strlen(string)), MPI_CHAR, comm, &string_pack_size), comm);
457
458 return (size_t)strlen_pack_size + (size_t)string_pack_size;
459}
460
462 union yac_interp_stack_config_entry * entry, MPI_Comm comm) {
463
464 int int_pack_size, dbl_pack_size;
465 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &int_pack_size), comm);
466 yac_mpi_call(MPI_Pack_size(1, MPI_DOUBLE, comm, &dbl_pack_size), comm);
467
469 entry->general.type,
470 "yac_interp_stack_config_get_entry_pack_size");
472 entry->general.type != YAC_UNDEFINED,
473 "ERROR(yac_interp_stack_config_get_entry_pack_size): "
474 "invalid interpolation type")
475 switch (entry->general.type) {
476 default:
477 case (YAC_AVERAGE):
478 return (size_t)int_pack_size + // type
479 (size_t)int_pack_size + // reduction_type
480 (size_t)int_pack_size; // partial_coverage
483 return (size_t)int_pack_size + // type
484 (size_t)int_pack_size + // weight_type
485 (size_t)int_pack_size + // n
486 (size_t)dbl_pack_size; // scale
487 case (YAC_CONSERVATIVE):
488 return (size_t)int_pack_size + // type
489 (size_t)int_pack_size + // order
490 (size_t)int_pack_size + // enforced_conserv
491 (size_t)int_pack_size + // partial_coverage
492 (size_t)int_pack_size; // normalisation
494 return (size_t)int_pack_size + // type
495 (size_t)dbl_pack_size + // spread_distance
496 (size_t)dbl_pack_size + // max_search_distance
497 (size_t)int_pack_size + // weight_type
498 (size_t)int_pack_size + // scale_type
499 (size_t)dbl_pack_size + // src_sphere_radius
500 (size_t)dbl_pack_size; // tgt_sphere_radius
501 case (YAC_FIXED_VALUE):
502 return (size_t)int_pack_size + // type
503 (size_t)dbl_pack_size; // value
505 return (size_t)int_pack_size; // type
506 case (YAC_USER_FILE):
507 return (size_t)int_pack_size + // type
509 entry->user_file.filename, comm) +
511 entry->user_file.src_grid_name, comm) +
513 entry->user_file.tgt_grid_name, comm);
514 case (YAC_CHECK):
515 return (size_t)int_pack_size + // type
517 entry->check.constructor_key, comm) + // constructor_key
519 entry->check.do_search_key, comm); // do_search_key
520 case (YAC_CREEP):
521 return (size_t)int_pack_size + // type
522 (size_t)int_pack_size; // creep_distance
523 case (YAC_USER_CALLBACK):
524 return (size_t)int_pack_size + // type
527 // func_compute_weights_key
529 return (size_t)int_pack_size + // type
530 (size_t)int_pack_size + // weight_type
531 (size_t)int_pack_size; // partial_coverage
532 }
533}
534
536 struct yac_interp_stack_config * interp_stack, MPI_Comm comm) {
537
538 int size_pack_size;
539 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &size_pack_size), comm);
540
541 size_t config_pack_size = 0;
542
543 for (size_t i = 0; i < interp_stack->size; ++i)
544 config_pack_size +=
546 interp_stack->config + i, comm);
547
548 return (size_t)size_pack_size + config_pack_size;
549}
550
552 char const * string, void * buffer, int buffer_size, int * position,
553 MPI_Comm comm) {
554
555 size_t len = (string == NULL)?0:strlen(string);
556
558 len <= INT_MAX, "ERROR(yac_interp_stack_config_pack_string): string too long")
559
560 int len_int = (int)len;
561
563 MPI_Pack(
564 &len_int, 1, MPI_INT, buffer, buffer_size, position, comm), comm);
565
566 if (len > 0)
568 MPI_Pack(
569 string, len_int, MPI_CHAR, buffer, buffer_size, position, comm),
570 comm);
571}
572
574 union yac_interp_stack_config_entry * entry,
575 void * buffer, int buffer_size, int * position, MPI_Comm comm) {
576
577 int type = (int)(entry->general.type);
579 MPI_Pack(&type, 1, MPI_INT, buffer, buffer_size, position, comm), comm);
580
582 entry->general.type,
583 "yac_interp_stack_config_pack_entry");
585 entry->general.type != YAC_UNDEFINED,
586 "ERROR(yac_interp_stack_config_pack_entry): "
587 "invalid interpolation type")
588 switch (entry->general.type) {
589 default:
590 case (YAC_AVERAGE): {
591 int reduction_type = (int)(entry->average.reduction_type);
593 MPI_Pack(
594 &reduction_type, 1, MPI_INT, buffer, buffer_size, position, comm),
595 comm);
597 MPI_Pack(
598 &(entry->average.partial_coverage), 1, MPI_INT,
599 buffer, buffer_size, position, comm), comm);
600 break;
601 }
603 case (YAC_N_NEAREST_NEIGHBOR): {
605 entry->n_nearest_neighbor.config.n <= INT_MAX,
606 "ERROR(yac_interp_stack_config_pack_entry): "
607 "n_nearest_neighbor.config.n bigger than INT_MAX")
608 int type = (int)(entry->n_nearest_neighbor.config.type);
610 MPI_Pack(
611 &type, 1, MPI_INT, buffer, buffer_size, position, comm), comm);
612 int n = (int)(entry->n_nearest_neighbor.config.n);
614 MPI_Pack(
615 &n, 1, MPI_INT, buffer, buffer_size, position, comm), comm);
617 MPI_Pack(
618 &(entry->n_nearest_neighbor.config.data.rbf_scale), 1, MPI_DOUBLE,
619 buffer, buffer_size, position, comm), comm);
620 break;
621 }
622 case (YAC_CONSERVATIVE): {
624 MPI_Pack(
625 &(entry->conservative.order), 1, MPI_INT,
626 buffer, buffer_size, position, comm), comm);
628 MPI_Pack(
629 &(entry->conservative.enforced_conserv), 1, MPI_INT,
630 buffer, buffer_size, position, comm), comm);
632 MPI_Pack(
633 &(entry->conservative.partial_coverage), 1, MPI_INT,
634 buffer, buffer_size, position, comm), comm);
635 int normalisation = (int)(entry->conservative.normalisation);
637 MPI_Pack(
638 &normalisation, 1, MPI_INT, buffer, buffer_size, position, comm),
639 comm);
640 break;
641 }
644 MPI_Pack(
645 &(entry->spmap.spread_distance), 1, MPI_DOUBLE,
646 buffer, buffer_size, position, comm), comm);
648 MPI_Pack(
649 &(entry->spmap.max_search_distance), 1, MPI_DOUBLE,
650 buffer, buffer_size, position, comm), comm);
651 int weight_type = (int)(entry->spmap.weight_type);
653 MPI_Pack(
654 &weight_type, 1, MPI_INT, buffer, buffer_size, position, comm),
655 comm);
656 int scale_type = (int)(entry->spmap.scale_type);
658 MPI_Pack(
659 &scale_type, 1, MPI_INT, buffer, buffer_size, position, comm),
660 comm);
662 MPI_Pack(
663 &(entry->spmap.src_sphere_radius), 1, MPI_DOUBLE,
664 buffer, buffer_size, position, comm), comm);
666 MPI_Pack(
667 &(entry->spmap.tgt_sphere_radius), 1, MPI_DOUBLE,
668 buffer, buffer_size, position, comm), comm);
669 break;
670 }
671 case (YAC_FIXED_VALUE): {
673 MPI_Pack(
674 &(entry->fixed.value), 1, MPI_DOUBLE,
675 buffer, buffer_size, position, comm), comm);
676 break;
677 }
679 break;
680 case (YAC_USER_FILE): {
682 entry->user_file.filename, buffer, buffer_size, position, comm);
684 entry->user_file.src_grid_name, buffer, buffer_size, position, comm);
686 entry->user_file.tgt_grid_name, buffer, buffer_size, position, comm);
687 break;
688 }
689 case (YAC_CHECK): {
691 entry->check.constructor_key, buffer, buffer_size, position, comm);
693 entry->check.do_search_key, buffer, buffer_size, position, comm);
694 break;
695 }
696 case (YAC_CREEP): {
698 MPI_Pack(
699 &(entry->creep.creep_distance), 1, MPI_INT,
700 buffer, buffer_size, position, comm), comm);
701 break;
702 }
703 case (YAC_USER_CALLBACK): {
706 buffer, buffer_size, position, comm);
707 break;
708 }
710 int weight_type = (int)(entry->nearest_corner_cells.weight_type);
712 MPI_Pack(
713 &weight_type, 1, MPI_INT, buffer, buffer_size, position, comm),
714 comm);
716 MPI_Pack(
717 &(entry->nearest_corner_cells.partial_coverage), 1, MPI_INT,
718 buffer, buffer_size, position, comm), comm);
719 break;
720 }
721 }
722}
723
725 struct yac_interp_stack_config * interp_stack,
726 void * buffer, int buffer_size, int * position, MPI_Comm comm) {
727
728 int stack_size = (int)(interp_stack->size);
730 MPI_Pack(
731 &stack_size, 1, MPI_INT,
732 buffer, buffer_size, position, comm), comm);
733
734 for (size_t i = 0; i < interp_stack->size; ++i)
736 interp_stack->config + i, buffer, buffer_size, position, comm);
737}
738
740 void * buffer, int buffer_size, int * position,
741 char * string, int max_string_len, MPI_Comm comm) {
742
743 int string_len;
745 MPI_Unpack(
746 buffer, buffer_size, position, &string_len, 1, MPI_INT, comm), comm);
747
749 string_len >= 0,
750 "ERROR(yac_interp_stack_config_unpack_n_string): invalid string length")
751
753 string_len < max_string_len,
754 "ERROR(yac_interp_stack_config_unpack_n_string): string length to long")
755
756 if (string_len > 0)
758 MPI_Unpack(
759 buffer, buffer_size, position, string, string_len, MPI_CHAR, comm),
760 comm);
761 string[string_len] = '\0';
762}
763
765 void * buffer, int buffer_size, int * position,
766 union yac_interp_stack_config_entry * entry, MPI_Comm comm) {
767
768 int type;
770 MPI_Unpack(
771 buffer, buffer_size, position, &type, 1, MPI_INT, comm), comm);
772
774
776 entry->general.type,
777 "yac_interp_stack_config_unpack_entry");
779 entry->general.type != YAC_UNDEFINED,
780 "ERROR(yac_interp_stack_config_unpack_entry): "
781 "invalid interpolation type")
782 switch (type) {
783 default:
784 case (YAC_AVERAGE): {
785 int reduction_type;
787 MPI_Unpack(
788 buffer, buffer_size, position, &reduction_type, 1, MPI_INT, comm),
789 comm);
790 entry->average.reduction_type =
791 (enum yac_interp_avg_weight_type)reduction_type;
793 MPI_Unpack(
794 buffer, buffer_size, position, &(entry->average.partial_coverage),
795 1, MPI_INT, comm), comm);
796 break;
797 }
799 case (YAC_N_NEAREST_NEIGHBOR): {
800 int type;
802 MPI_Unpack(
803 buffer, buffer_size, position, &type, 1, MPI_INT, comm), comm);
806 int n;
808 MPI_Unpack(
809 buffer, buffer_size, position, &n, 1, MPI_INT, comm), comm);
811 n >= 0,
812 "ERROR(yac_interp_stack_config_unpack_entry): "
813 "invalid n_nearest_neighbor.config.n")
814 entry->n_nearest_neighbor.config.n = (size_t)n;
816 MPI_Unpack(
817 buffer, buffer_size, position,
819 1, MPI_DOUBLE, comm), comm);
820 break;
821 }
822 case (YAC_CONSERVATIVE): {
824 MPI_Unpack(
825 buffer, buffer_size, position,
826 &(entry->conservative.order), 1, MPI_INT, comm), comm);
828 MPI_Unpack(
829 buffer, buffer_size, position,
830 &(entry->conservative.enforced_conserv), 1, MPI_INT, comm), comm);
832 MPI_Unpack(
833 buffer, buffer_size, position,
834 &(entry->conservative.partial_coverage), 1, MPI_INT, comm), comm);
835 int normalisation;
837 MPI_Unpack(
838 buffer, buffer_size, position, &normalisation, 1, MPI_INT, comm),
839 comm);
841 (enum yac_interp_method_conserv_normalisation)normalisation;
842 break;
843 }
846 MPI_Unpack(
847 buffer, buffer_size, position,
848 &(entry->spmap.spread_distance), 1, MPI_DOUBLE, comm), comm);
850 MPI_Unpack(
851 buffer, buffer_size, position,
852 &(entry->spmap.max_search_distance), 1, MPI_DOUBLE, comm), comm);
853 int weight_type;
855 MPI_Unpack(
856 buffer, buffer_size, position, &weight_type, 1, MPI_INT, comm),
857 comm);
858 entry->spmap.weight_type =
859 (enum yac_interp_spmap_weight_type)weight_type;
860 int scale_type;
862 MPI_Unpack(
863 buffer, buffer_size, position, &scale_type, 1, MPI_INT, comm),
864 comm);
865 entry->spmap.scale_type =
866 (enum yac_interp_spmap_weight_type)scale_type;
868 MPI_Unpack(
869 buffer, buffer_size, position,
870 &(entry->spmap.src_sphere_radius), 1, MPI_DOUBLE, comm), comm);
872 MPI_Unpack(
873 buffer, buffer_size, position,
874 &(entry->spmap.tgt_sphere_radius), 1, MPI_DOUBLE, comm), comm);
875 break;
876 }
877 case (YAC_FIXED_VALUE): {
879 MPI_Unpack(
880 buffer, buffer_size, position,
881 &(entry->fixed.value), 1, MPI_DOUBLE, comm), comm);
882 break;
883 }
885 break;
886 case (YAC_USER_FILE): {
888 buffer, buffer_size, position,
891 buffer, buffer_size, position,
894 buffer, buffer_size, position,
896 break;
897 }
898 case (YAC_CHECK): {
900 buffer, buffer_size, position,
903 buffer, buffer_size, position,
905 break;
906 }
907 case (YAC_CREEP): {
909 MPI_Unpack(
910 buffer, buffer_size, position,
911 &(entry->creep.creep_distance), 1, MPI_INT, comm), comm);
912 break;
913 }
914 case (YAC_USER_CALLBACK): {
916 buffer, buffer_size, position,
919 break;
920 }
922 int weight_type;
924 MPI_Unpack(
925 buffer, buffer_size, position, &weight_type, 1, MPI_INT, comm),
926 comm);
928 (enum yac_interp_ncc_weight_type)weight_type;
930 MPI_Unpack(
931 buffer, buffer_size, position,
933 1, MPI_INT, comm), comm);
934 break;
935 }
936 }
937}
938
940 void * buffer, int buffer_size, int * position, MPI_Comm comm) {
941
942 int stack_size;
944 MPI_Unpack(
945 buffer, buffer_size, position, &stack_size, 1, MPI_INT, comm), comm);
946
948 stack_size >= 0,
949 "ERROR(yac_interp_stack_config_unpack_interp_stack): invalid stack size")
950
951 struct yac_interp_stack_config * interp_stack =
953
954 interp_stack->size = (size_t)stack_size;
955 interp_stack->config =
956 xmalloc((size_t)stack_size * sizeof(*interp_stack->config));
957
958 for (int i = 0; i < stack_size; ++i)
960 buffer, buffer_size, position, interp_stack->config + (size_t)i, comm);
961
962 return interp_stack;
963}
964
966
967 struct yac_interp_stack_config * interp_stack_config =
968 xmalloc(1 * sizeof(*interp_stack_config));
969 interp_stack_config->config = NULL;
970 interp_stack_config->size = 0;
971
972 return interp_stack_config;
973}
975 struct yac_interp_stack_config * interp_stack_config) {
976 free(interp_stack_config->config);
977 free(interp_stack_config);
978}
979
982 struct yac_interp_stack_config * interp_stack_config) {
983
984 interp_stack_config->size++;
985 interp_stack_config->config =
986 xrealloc(
987 interp_stack_config->config,
988 interp_stack_config->size * sizeof(*(interp_stack_config->config)));
989
990 return interp_stack_config->config + (interp_stack_config->size - 1);
991}
992
1004
1006 struct yac_interp_stack_config * interp_stack_config,
1008
1009 YAC_ASSERT(
1013 "ERROR(yac_interp_stack_config_add_average_f2c): "
1014 "reduction_type must be one of "
1015 "YAC_INTERP_AVG_ARITHMETIC/YAC_INTERP_AVG_DIST/YAC_INTERP_AVG_BARY");
1016
1018 interp_stack_config, (enum yac_interp_avg_weight_type)reduction_type,
1020}
1021
1033
1035 struct yac_interp_stack_config * interp_stack_config,
1036 int weight_type, int partial_coverage) {
1037
1038 YAC_ASSERT(
1041 "ERROR(yac_interp_stack_config_add_ncc_f2c): "
1042 "weight_type must be one of "
1043 "YAC_INTERP_NCC_AVG/YAC_INTERP_NCC_DIST");
1044
1046 interp_stack_config, (enum yac_interp_ncc_weight_type)weight_type,
1048}
1049
1051 struct yac_interp_stack_config * interp_stack_config,
1052 enum yac_interp_nnn_weight_type type, size_t n, double scale) {
1053
1054 union yac_interp_stack_config_entry * entry =
1055 yac_interp_stack_config_add_entry(interp_stack_config);
1056
1057 if (type == YAC_INTERP_NNN_RBF) {
1060 (struct yac_nnn_config){
1061 .type = YAC_INTERP_NNN_RBF, .n = n, .data.rbf_scale = scale};
1062 } else {
1064 entry->n_nearest_neighbor.config =
1065 (struct yac_nnn_config){
1066 .type = type, .n = n, .data.rbf_scale = scale};
1067 }
1068}
1069
1071 struct yac_interp_stack_config * interp_stack_config,
1072 int type, size_t n, double scale) {
1073
1074 YAC_ASSERT(
1075 (type == YAC_INTERP_NNN_AVG) ||
1078 (type == YAC_INTERP_NNN_RBF) ||
1080 "ERROR(yac_interp_stack_config_add_nnn_f2c): "
1081 "type must be one of YAC_INTERP_NNN_AVG/YAC_INTERP_NNN_DIST/"
1082 "YAC_INTERP_NNN_GAUSS/YAC_INTERP_NNN_RBF/YAC_INTERP_NNN_ZERO.")
1083
1085 interp_stack_config, (enum yac_interp_nnn_weight_type)type, n, scale);
1086}
1087
1089 struct yac_interp_stack_config * interp_stack_config,
1090 int order, int enforced_conserv, int partial_coverage,
1091 enum yac_interp_method_conserv_normalisation normalisation) {
1092
1093 union yac_interp_stack_config_entry * entry =
1094 yac_interp_stack_config_add_entry(interp_stack_config);
1095
1097 entry->conservative.order = order;
1101}
1102
1104 struct yac_interp_stack_config * interp_stack_config,
1106 int normalisation) {
1107
1108 YAC_ASSERT(
1111 "ERROR(yac_interp_stack_config_add_conservative_f2c): "
1112 "type must be one of "
1113 "YAC_INTERP_CONSERV_DESTAREA/YAC_INTERP_CONSERV_FRACAREA.")
1114
1116 interp_stack_config, order, enforced_conserv, partial_coverage,
1118}
1119
1138
1140 struct yac_interp_stack_config * interp_stack_config,
1141 double spread_distance, double max_search_distance,
1142 int weight_type, int scale_type,
1143 double src_sphere_radius, double tgt_sphere_radius) {
1144
1145 YAC_ASSERT(
1148 "ERROR(yac_interp_stack_config_add_spmap_f2c): "
1149 "weight_type must be one of "
1150 "YAC_INTERP_SPMAP_AVG/YAC_INTERP_SPMAP_DIST.")
1151
1152 YAC_ASSERT(
1157 "ERROR(yac_interp_stack_config_add_spmap_f2c): "
1158 "scale_type must be one of "
1159 "YAC_INTERP_SPMAP_NONE/YAC_INTERP_SPMAP_SRCAREA/"
1160 "YAC_INTERP_SPMAP_INVTGTAREA/YAC_INTERP_SPMAP_FRACAREA.")
1161
1163 interp_stack_config, spread_distance, max_search_distance,
1167}
1168
1170 struct yac_interp_stack_config * interp_stack_config) {
1171
1172 union yac_interp_stack_config_entry * entry =
1173 yac_interp_stack_config_add_entry(interp_stack_config);
1174
1176}
1177
1178static void check_string(
1179 char const * string, char const * file, int line, char const * routine,
1180 char const * variable) {
1181
1183 string != NULL, "ERROR(%s:%d:%s): %s is NULL",
1184 file, line, routine, variable)
1186 strlen(string) < YAC_MAX_FILE_NAME_LENGTH,
1187 "ERROR(%s:%d:%s): %s is too long", file, line, routine, variable)
1188}
1189
1191 struct yac_interp_stack_config * interp_stack_config,
1192 char const * filename, char const * src_grid_name,
1193 char const * tgt_grid_name) {
1194
1196 filename, __FILE__, __LINE__,
1197 "yac_interp_stack_config_add_user_file", "filename");
1199 src_grid_name, __FILE__, __LINE__,
1200 "yac_interp_stack_config_add_user_file", "src_grid_name");
1202 tgt_grid_name, __FILE__, __LINE__,
1203 "yac_interp_stack_config_add_user_file", "tgt_grid_name");
1204
1205 union yac_interp_stack_config_entry * entry =
1206 yac_interp_stack_config_add_entry(interp_stack_config);
1207
1208 entry->user_file.type = YAC_USER_FILE;
1209 strcpy(entry->user_file.filename, filename);
1210 strcpy(entry->user_file.src_grid_name, src_grid_name);
1211 strcpy(entry->user_file.tgt_grid_name, tgt_grid_name);
1212}
1213
1215 struct yac_interp_stack_config * interp_stack_config, double value) {
1216
1217 union yac_interp_stack_config_entry * entry =
1218 yac_interp_stack_config_add_entry(interp_stack_config);
1219
1220 entry->fixed.type = YAC_FIXED_VALUE;
1221 entry->fixed.value = value;
1222}
1223
1225 struct yac_interp_stack_config * interp_stack_config,
1226 char const * constructor_key, char const * do_search_key) {
1227
1230 "ERROR(yac_interp_stack_config_add_check): "
1231 "constructor_key name \"%s\" is too long "
1232 "(has to be smaller than %d)", constructor_key, YAC_MAX_ROUTINE_NAME_LENGTH);
1235 "ERROR(yac_interp_stack_config_add_check): "
1236 "do_search_key name \"%s\" is too long "
1237 "(has to be smaller than %d)", do_search_key, YAC_MAX_ROUTINE_NAME_LENGTH);
1238
1239 union yac_interp_stack_config_entry * entry =
1240 yac_interp_stack_config_add_entry(interp_stack_config);
1241
1242 entry->check.type = YAC_CHECK;
1243 if (constructor_key) {
1244 strcpy(entry->check.constructor_key, constructor_key);
1245 } else {
1246 memset(entry->check.constructor_key, '\0',
1247 sizeof(entry->check.constructor_key));
1248 }
1249 if (do_search_key) {
1250 strcpy(entry->check.do_search_key, do_search_key);
1251 } else {
1252 memset(entry->check.do_search_key, '\0',
1253 sizeof(entry->check.do_search_key));
1254 }
1255}
1256
1258 struct yac_interp_stack_config * interp_stack_config, int creep_distance) {
1259
1260 union yac_interp_stack_config_entry * entry =
1261 yac_interp_stack_config_add_entry(interp_stack_config);
1262
1263 entry->creep.type = YAC_CREEP;
1265}
1266
1268 struct yac_interp_stack_config * interp_stack_config,
1269 char const * func_compute_weights_key) {
1270
1272 func_compute_weights_key, __FILE__, __LINE__,
1273 "yac_interp_stack_config_add_user_callback",
1274 "func_compute_weights_key");
1275
1276 union yac_interp_stack_config_entry * entry =
1277 yac_interp_stack_config_add_entry(interp_stack_config);
1278
1280 strcpy(
1282}
1283
1285 struct yac_interp_stack_config * interp_stack) {
1286
1287 return interp_stack->size;
1288}
1289
1292 struct yac_interp_stack_config * interp_stack,
1293 size_t interp_stack_idx) {
1294
1295 YAC_ASSERT(
1296 interp_stack_idx < interp_stack->size,
1297 "ERROR(yac_interp_stack_config_get_entry): "
1298 "invalid interpolation stack index");
1299
1300 return interp_stack->config + interp_stack_idx;
1301}
1302
1303
1305 union yac_interp_stack_config_entry const * interp_stack_entry) {
1306
1307 return interp_stack_entry->general.type;
1308}
1309
1311 union yac_interp_stack_config_entry const * interp_stack_entry,
1313 int * partial_coverage) {
1314
1315 YAC_ASSERT(
1316 interp_stack_entry->general.type == YAC_AVERAGE,
1317 "ERROR(yac_interp_stack_config_entry_get_average): "
1318 "wrong interpolation stack entry type");
1319
1320 *reduction_type = interp_stack_entry->average.reduction_type;
1321 *partial_coverage = interp_stack_entry->average.partial_coverage;
1322}
1323
1325 union yac_interp_stack_config_entry const * interp_stack_entry,
1327
1328 YAC_ASSERT(
1329 (interp_stack_entry->general.type == YAC_NEAREST_CORNER_CELLS),
1330 "ERROR(yac_interp_stack_config_entry_get_ncc): "
1331 "wrong interpolation stack entry type");
1332
1333 *type = interp_stack_entry->nearest_corner_cells.weight_type;
1335 interp_stack_entry->nearest_corner_cells.partial_coverage;
1336}
1337
1339 union yac_interp_stack_config_entry const * interp_stack_entry,
1340 enum yac_interp_nnn_weight_type * type, size_t * n, double * scale) {
1341
1342 YAC_ASSERT(
1343 (interp_stack_entry->general.type == YAC_N_NEAREST_NEIGHBOR) ||
1344 (interp_stack_entry->general.type == YAC_RADIAL_BASIS_FUNCTION),
1345 "ERROR(yac_interp_stack_config_entry_get_nnn): "
1346 "wrong interpolation stack entry type");
1347
1348 *type = interp_stack_entry->n_nearest_neighbor.config.type;
1349 *n = interp_stack_entry->n_nearest_neighbor.config.n;
1350 *scale = interp_stack_entry->n_nearest_neighbor.config.data.rbf_scale;
1351}
1352
1354 union yac_interp_stack_config_entry const * interp_stack_entry,
1355 int * order, int * enforced_conserv, int * partial_coverage,
1357
1358 YAC_ASSERT(
1359 interp_stack_entry->general.type == YAC_CONSERVATIVE,
1360 "ERROR(yac_interp_stack_config_entry_get_conservative): "
1361 "wrong interpolation stack entry type");
1362
1363 *order = interp_stack_entry->conservative.order;
1364 *enforced_conserv = interp_stack_entry->conservative.enforced_conserv;
1365 *partial_coverage = interp_stack_entry->conservative.partial_coverage;
1366 *normalisation = interp_stack_entry->conservative.normalisation;
1367}
1368
1370 union yac_interp_stack_config_entry const * interp_stack_entry,
1371 double * spread_distance, double * max_search_distance,
1374 double * src_sphere_radius, double * tgt_sphere_radius) {
1375
1376 YAC_ASSERT(
1377 interp_stack_entry->general.type == YAC_SOURCE_TO_TARGET_MAP,
1378 "ERROR(yac_interp_stack_config_entry_get_spmap): "
1379 "wrong interpolation stack entry type");
1380
1381 *spread_distance = interp_stack_entry->spmap.spread_distance;
1382 *max_search_distance = interp_stack_entry->spmap.max_search_distance;
1383 *weight_type = interp_stack_entry->spmap.weight_type;
1384 *scale_type = interp_stack_entry->spmap.scale_type;
1385 *src_sphere_radius = interp_stack_entry->spmap.src_sphere_radius;
1386 *tgt_sphere_radius = interp_stack_entry->spmap.tgt_sphere_radius;
1387}
1388
1390 union yac_interp_stack_config_entry const * interp_stack_entry,
1391 char const ** filename, char const ** src_grid_name,
1392 char const ** tgt_grid_name) {
1393
1394 YAC_ASSERT(
1395 interp_stack_entry->general.type == YAC_USER_FILE,
1396 "ERROR(yac_interp_stack_config_entry_get_user_file): "
1397 "wrong interpolation stack entry type");
1398
1399 *filename = interp_stack_entry->user_file.filename;
1400 *src_grid_name = interp_stack_entry->user_file.src_grid_name;
1401 *tgt_grid_name = interp_stack_entry->user_file.tgt_grid_name;
1402}
1403
1405 union yac_interp_stack_config_entry const * interp_stack_entry,
1406 double * value) {
1407
1408 YAC_ASSERT(
1409 interp_stack_entry->general.type == YAC_FIXED_VALUE,
1410 "ERROR(yac_interp_stack_config_entry_get_fixed): "
1411 "wrong interpolation stack entry type");
1412
1413 *value = interp_stack_entry->fixed.value;
1414}
1415
1417 union yac_interp_stack_config_entry const * interp_stack_entry,
1418 char const ** constructor_key, char const ** do_search_key) {
1419
1420 YAC_ASSERT(
1421 interp_stack_entry->general.type == YAC_CHECK,
1422 "ERROR(yac_interp_stack_config_entry_get_check): "
1423 "wrong interpolation stack entry type");
1424
1425 *constructor_key = interp_stack_entry->check.constructor_key;
1426 *do_search_key = interp_stack_entry->check.do_search_key;
1427}
1428
1430 union yac_interp_stack_config_entry const * interp_stack_entry,
1431 int * creep_distance) {
1432
1433 YAC_ASSERT(
1434 interp_stack_entry->general.type == YAC_CREEP,
1435 "ERROR(yac_interp_stack_config_entry_get_creep): "
1436 "wrong interpolation stack entry type");
1437
1438 *creep_distance = interp_stack_entry->creep.creep_distance;
1439}
1440
1442 union yac_interp_stack_config_entry const * interp_stack_entry,
1443 char const ** func_compute_weights_key) {
1444
1445 YAC_ASSERT(
1446 interp_stack_entry->general.type == YAC_USER_CALLBACK,
1447 "ERROR(yac_interp_stack_config_entry_get_user_callback): "
1448 "wrong interpolation stack entry type");
1449
1451 interp_stack_entry->user_callback.func_compute_weights_key;
1452}
#define yac_angle_tol
Definition geometry.h:34
struct interp_method * yac_interp_method_avg_new(enum yac_interp_avg_weight_type weight_type, int partial_coverage)
yac_interp_avg_weight_type
@ YAC_INTERP_AVG_DIST
@ YAC_INTERP_AVG_ARITHMETIC
@ YAC_INTERP_AVG_BARY
void * user_data
void yac_interp_method_callback_get_compute_weights_callback(char const *key, yac_func_compute_weights *compute_weights_callback, void **user_data)
static size_t do_search_callback(struct interp_method *method, struct yac_interp_grid *interp_grid, size_t *tgt_points, size_t count, struct yac_interp_weights *weights)
struct interp_method * yac_interp_method_callback_new(yac_func_compute_weights compute_weights_callback, void *user_data)
void(* yac_func_compute_weights)(double const tgt_coords[3], int src_cell_id, size_t src_cell_idx, int const **global_results_points, double **result_weights, size_t *result_count, void *user_data)
void yac_interp_method_check_get_do_search_callback(char const *key, func_do_search *do_search_callback, void **user_data)
void yac_interp_method_check_get_constructor_callback(char const *key, func_constructor *constructor_callback, void **user_data)
struct @8::@9 value
enum callback_type type
struct interp_method * yac_interp_method_check_new(func_constructor constructor_callback, void *constructor_user_data, func_do_search do_search_callback, void *do_search_user_data)
void(* func_do_search)(yac_int const *global_ids, double const (*coordinates_xyz)[3], size_t count, void *user_data)
void(* func_constructor)(void *user_data)
struct interp_method * yac_interp_method_conserv_new(int order, int enforced_conserv, int partial_coverage, enum yac_interp_method_conserv_normalisation normalisation)
yac_interp_method_conserv_normalisation
@ YAC_INTERP_CONSERV_DESTAREA
@ YAC_INTERP_CONSERV_FRACAREA
struct interp_method * yac_interp_method_creep_new(int creep_distance)
struct interp_method * yac_interp_method_file_new(char const *weight_file_name, char const *src_grid_name, char const *tgt_grid_name)
struct interp_method * yac_interp_method_fixed_new(double value)
struct interp_method * yac_interp_method_hcsbb_new()
struct interp_method * yac_interp_method_ncc_new(enum yac_interp_ncc_weight_type weight_type, int partial_coverage)
yac_interp_ncc_weight_type
@ YAC_INTERP_NCC_DIST
distance weighted average of n source points
@ YAC_INTERP_NCC_AVG
average of n source points
struct interp_method * yac_interp_method_nnn_new(struct yac_nnn_config config)
yac_interp_nnn_weight_type
@ YAC_INTERP_NNN_GAUSS
distance with Gauss weights of n source points
@ YAC_INTERP_NNN_RBF
radial basis functions
@ YAC_INTERP_NNN_AVG
average of n source points
@ YAC_INTERP_NNN_DIST
distance weighted average of n source points
@ YAC_INTERP_NNN_ZERO
all weights are set to zero
struct interp_method * yac_interp_method_spmap_new(double spread_distance, double max_search_distance, enum yac_interp_spmap_weight_type weight_type, enum yac_interp_spmap_scale_type scale_type, double src_sphere_radius, double tgt_sphere_radius)
yac_interp_spmap_scale_type
@ YAC_INTERP_SPMAP_NONE
weights are not scaled
@ YAC_INTERP_SPMAP_INVTGTAREA
@ YAC_INTERP_SPMAP_SRCAREA
@ YAC_INTERP_SPMAP_FRACAREA
yac_interp_spmap_weight_type
@ YAC_INTERP_SPMAP_AVG
@ YAC_INTERP_SPMAP_DIST
void yac_interp_stack_config_entry_get_creep(union yac_interp_stack_config_entry const *interp_stack_entry, int *creep_distance)
void yac_interp_stack_config_add_check(struct yac_interp_stack_config *interp_stack_config, char const *constructor_key, char const *do_search_key)
size_t yac_interp_stack_config_get_size(struct yac_interp_stack_config *interp_stack)
void yac_interp_stack_config_add_user_file(struct yac_interp_stack_config *interp_stack_config, char const *filename, char const *src_grid_name, char const *tgt_grid_name)
void yac_interp_stack_config_add_nnn_f2c(struct yac_interp_stack_config *interp_stack_config, int type, size_t n, double scale)
void yac_interp_stack_config_entry_get_user_file(union yac_interp_stack_config_entry const *interp_stack_entry, char const **filename, char const **src_grid_name, char const **tgt_grid_name)
void yac_interp_stack_config_add_spmap_f2c(struct yac_interp_stack_config *interp_stack_config, double spread_distance, double max_search_distance, int weight_type, int scale_type, double src_sphere_radius, double tgt_sphere_radius)
int yac_interp_stack_config_compare(void const *a_, void const *b_)
static union yac_interp_stack_config_entry * yac_interp_stack_config_add_entry(struct yac_interp_stack_config *interp_stack_config)
void yac_interp_stack_config_add_spmap(struct yac_interp_stack_config *interp_stack_config, double spread_distance, double max_search_distance, enum yac_interp_spmap_weight_type weight_type, enum yac_interp_spmap_scale_type scale_type, double src_sphere_radius, double tgt_sphere_radius)
union yac_interp_stack_config_entry const * yac_interp_stack_config_get_entry(struct yac_interp_stack_config *interp_stack, size_t interp_stack_idx)
static void yac_interp_stack_config_pack_string(char const *string, void *buffer, int buffer_size, int *position, MPI_Comm comm)
enum yac_interpolation_list yac_interp_stack_config_entry_get_type(union yac_interp_stack_config_entry const *interp_stack_entry)
void yac_interp_stack_config_add_nnn(struct yac_interp_stack_config *interp_stack_config, enum yac_interp_nnn_weight_type type, size_t n, double scale)
void yac_interp_stack_config_add_fixed(struct yac_interp_stack_config *interp_stack_config, double value)
void yac_interp_stack_config_add_hcsbb(struct yac_interp_stack_config *interp_stack_config)
void yac_interp_stack_config_add_average(struct yac_interp_stack_config *interp_stack_config, enum yac_interp_avg_weight_type reduction_type, int partial_coverage)
static void yac_interp_stack_config_pack_entry(union yac_interp_stack_config_entry *entry, void *buffer, int buffer_size, int *position, MPI_Comm comm)
void yac_interp_stack_config_add_creep(struct yac_interp_stack_config *interp_stack_config, int creep_distance)
static size_t yac_interp_stack_config_get_string_pack_size(char const *string, MPI_Comm comm)
void yac_interp_stack_config_entry_get_ncc(union yac_interp_stack_config_entry const *interp_stack_entry, enum yac_interp_ncc_weight_type *type, int *partial_coverage)
void yac_interp_stack_config_add_conservative_f2c(struct yac_interp_stack_config *interp_stack_config, int order, int enforced_conserv, int partial_coverage, int normalisation)
static void yac_interp_stack_config_unpack_entry(void *buffer, int buffer_size, int *position, union yac_interp_stack_config_entry *entry, MPI_Comm comm)
struct yac_interp_stack_config * yac_interp_stack_config_unpack(void *buffer, int buffer_size, int *position, MPI_Comm comm)
void yac_interp_stack_config_add_ncc_f2c(struct yac_interp_stack_config *interp_stack_config, int weight_type, int partial_coverage)
static void check_interpolation_type(enum yac_interpolation_list type, char const *routine)
void yac_interp_stack_config_delete(struct yac_interp_stack_config *interp_stack_config)
void yac_interp_stack_config_entry_get_spmap(union yac_interp_stack_config_entry const *interp_stack_entry, double *spread_distance, double *max_search_distance, enum yac_interp_spmap_weight_type *weight_type, enum yac_interp_spmap_scale_type *scale_type, double *src_sphere_radius, double *tgt_sphere_radius)
void yac_interp_stack_config_entry_get_user_callback(union yac_interp_stack_config_entry const *interp_stack_entry, char const **func_compute_weights_key)
struct yac_interp_stack_config * yac_interp_stack_config_copy(struct yac_interp_stack_config *interp_stack)
void yac_interp_stack_config_add_conservative(struct yac_interp_stack_config *interp_stack_config, int order, int enforced_conserv, int partial_coverage, enum yac_interp_method_conserv_normalisation normalisation)
void yac_interp_stack_config_entry_get_check(union yac_interp_stack_config_entry const *interp_stack_entry, char const **constructor_key, char const **do_search_key)
static int yac_interp_stack_config_entry_compare(void const *a_, void const *b_)
struct interp_method ** yac_interp_stack_config_generate(struct yac_interp_stack_config *interp_stack)
void yac_interp_stack_config_entry_get_conservative(union yac_interp_stack_config_entry const *interp_stack_entry, int *order, int *enforced_conserv, int *partial_coverage, enum yac_interp_method_conserv_normalisation *normalisation)
void yac_interp_stack_config_entry_get_average(union yac_interp_stack_config_entry const *interp_stack_entry, enum yac_interp_avg_weight_type *reduction_type, int *partial_coverage)
size_t yac_interp_stack_config_get_pack_size(struct yac_interp_stack_config *interp_stack, MPI_Comm comm)
void yac_interp_stack_config_add_average_f2c(struct yac_interp_stack_config *interp_stack_config, int reduction_type, int partial_coverage)
void yac_interp_stack_config_add_ncc(struct yac_interp_stack_config *interp_stack_config, enum yac_interp_ncc_weight_type weight_type, int partial_coverage)
void yac_interp_stack_config_add_user_callback(struct yac_interp_stack_config *interp_stack_config, char const *func_compute_weights_key)
static void yac_interp_stack_config_unpack_n_string(void *buffer, int buffer_size, int *position, char *string, int max_string_len, MPI_Comm comm)
struct yac_interp_stack_config * yac_interp_stack_config_new()
void yac_interp_stack_config_pack(struct yac_interp_stack_config *interp_stack, void *buffer, int buffer_size, int *position, MPI_Comm comm)
static void check_string(char const *string, char const *file, int line, char const *routine, char const *variable)
void yac_interp_stack_config_entry_get_fixed(union yac_interp_stack_config_entry const *interp_stack_entry, double *value)
static size_t yac_interp_stack_config_get_entry_pack_size(union yac_interp_stack_config_entry *entry, MPI_Comm comm)
void yac_interp_stack_config_entry_get_nnn(union yac_interp_stack_config_entry const *interp_stack_entry, enum yac_interp_nnn_weight_type *type, size_t *n, double *scale)
yac_interpolation_list
@ YAC_N_NEAREST_NEIGHBOR
@ YAC_CREEP
@ YAC_USER_FILE
@ YAC_USER_CALLBACK
@ YAC_SOURCE_TO_TARGET_MAP
@ YAC_CONSERVATIVE
@ YAC_FIXED_VALUE
@ YAC_UNDEFINED
@ YAC_CHECK
@ YAC_BERNSTEIN_BEZIER
@ YAC_NEAREST_CORNER_CELLS
@ YAC_RADIAL_BASIS_FUNCTION
@ YAC_AVERAGE
#define YAC_MAX_ROUTINE_NAME_LENGTH
#define YAC_MAX_FILE_NAME_LENGTH
#define xrealloc(ptr, size)
Definition ppm_xfuncs.h:67
#define xmalloc(size)
Definition ppm_xfuncs.h:66
union yac_interp_stack_config_entry * config
union yac_nnn_config::@22 data
enum yac_interp_nnn_weight_type type
double tgt_sphere_radius
struct yac_interp_stack_config_entry::@28 hcsbb
enum yac_interp_ncc_weight_type weight_type
double value
char do_search_key[YAC_MAX_ROUTINE_NAME_LENGTH]
double src_sphere_radius
struct yac_interp_stack_config_entry::@26 conservative
struct yac_interp_stack_config_entry::@23 general
struct yac_interp_stack_config_entry::@25 n_nearest_neighbor
struct yac_interp_stack_config_entry::@31 check
double max_search_distance
char src_grid_name[YAC_MAX_FILE_NAME_LENGTH]
enum yac_interpolation_list type
struct yac_interp_stack_config_entry::@27 spmap
int partial_coverage
struct yac_nnn_config config
char tgt_grid_name[YAC_MAX_FILE_NAME_LENGTH]
struct yac_interp_stack_config_entry::@24 average
int creep_distance
int enforced_conserv
int order
double spread_distance
char constructor_key[YAC_MAX_ROUTINE_NAME_LENGTH]
enum yac_interp_avg_weight_type reduction_type
struct yac_interp_stack_config_entry::@33 user_callback
enum yac_interp_spmap_scale_type scale_type
struct yac_interp_stack_config_entry::@29 user_file
enum yac_interp_method_conserv_normalisation normalisation
char filename[YAC_MAX_FILE_NAME_LENGTH]
struct yac_interp_stack_config_entry::@30 fixed
enum yac_interp_spmap_weight_type weight_type
struct yac_interp_stack_config_entry::@25 radial_basis_function
struct yac_interp_stack_config_entry::@32 creep
struct yac_interp_stack_config_entry::@34 nearest_corner_cells
char func_compute_weights_key[YAC_MAX_ROUTINE_NAME_LENGTH]
#define YAC_ASSERT_F(exp, format,...)
Definition yac_assert.h:18
#define YAC_ASSERT(exp, msg)
Definition yac_assert.h:15
#define yac_mpi_call(call, comm)