uberdriver.h
Go to the documentation of this file.
1 /*
2  This file is part of the Ristra portage project.
3  Please see the license file at the root of this repository, or at:
4  https://github.com/laristra/portage/blob/master/LICENSE
5 */
6 
7 #ifndef PORTAGE_GENREMAP_DRIVER_H_
8 #define PORTAGE_GENREMAP_DRIVER_H_
9 
10 #include <sys/time.h>
11 
12 #include <algorithm>
13 #include <vector>
14 #include <iterator>
15 #include <string>
16 #include <utility>
17 #include <iostream>
18 #include <type_traits>
19 #include <memory>
20 #include <limits>
21 
22 #ifdef HAVE_TANGRAM
23 #include "tangram/driver/driver.h"
24 #include "tangram/intersect/split_r2d.h"
25 #include "tangram/intersect/split_r3d.h"
26 
28 #endif
29 
31 
37 #include "wonton/mesh/flat/flat_mesh_wrapper.h"
38 #include "wonton/state/flat/flat_state_mm_wrapper.h"
39 #include "wonton/support/Point.h"
40 #include "wonton/state/state_vector_multi.h"
42 
43 
44 #ifdef PORTAGE_ENABLE_MPI
46 #endif
47 
57 namespace Portage {
58 
59 
60 
61 using Wonton::CELL;
62 using Wonton::NODE;
63 using Wonton::Flat_Mesh_Wrapper;
64 using Wonton::Flat_State_Wrapper;
65 
92 template <int D,
93  class SourceMesh, class SourceState,
94  class TargetMesh = SourceMesh, class TargetState = SourceState,
95  template <class, int, class, class> class InterfaceReconstructorType =
96  DummyInterfaceReconstructor,
97  class Matpoly_Splitter = void, class Matpoly_Clipper = void,
98  class CoordSys = Wonton::DefaultCoordSys
99  >
100 class UberDriver {
101  public:
102 
103  // A couple of shorthand notations
104 
105  using SerialDriverType =
106  CoreDriverBase<D, SourceMesh, SourceState,
107  TargetMesh, TargetState,
108  InterfaceReconstructorType,
109  Matpoly_Splitter, Matpoly_Clipper, CoordSys>;
110 
111  // NOTE: Unused
112  using ParallelDriverType =
114  Flat_State_Wrapper<Flat_Mesh_Wrapper<>>,
115  TargetMesh, TargetState,
116  InterfaceReconstructorType,
117  Matpoly_Splitter, Matpoly_Clipper, CoordSys>;
118 
131  UberDriver(SourceMesh const& source_mesh,
132  SourceState const& source_state,
133  TargetMesh const& target_mesh,
134  TargetState& target_state,
135  std::vector<std::string> const& source_vars_to_remap,
136  Wonton::Executor_type const *executor = nullptr,
137  std::string *errmsg = nullptr)
138  : source_mesh_(source_mesh),
139  target_mesh_(target_mesh),
140  source_state_(source_state),
141  target_state_(target_state),
142  dim_(source_mesh.space_dimension()),
143  source_vars_to_remap_(source_vars_to_remap),
144  executor_(executor) {
145 
146  assert(source_mesh.space_dimension() == target_mesh.space_dimension());
147 
148  // Record all the field types we are remapping and all the kinds
149  // of entities we are remapping on
150 
151  entity_kinds_.clear();
152  for (auto const& source_varname : source_vars_to_remap_) {
153  Entity_kind onwhat = source_state_.get_entity(source_varname);
154  if (std::find(entity_kinds_.begin(), entity_kinds_.end(), onwhat) ==
155  entity_kinds_.end())
156  entity_kinds_.push_back(onwhat);
157 
158  Field_type fieldtype = source_state_.field_type(onwhat, source_varname);
159  if (std::find(field_types_.begin(), field_types_.end(), fieldtype) ==
160  field_types_.end())
161  field_types_.push_back(fieldtype);
162 
163  if (fieldtype == Field_type::MULTIMATERIAL_FIELD)
164  have_multi_material_fields_ = true;
165  }
166 
167  // Make the internal drivers for each entity kind
168 
169  instantiate_core_drivers();
170  }
171 
181  UberDriver(SourceMesh const& source_mesh,
182  SourceState const& source_state,
183  TargetMesh const& target_mesh,
184  TargetState& target_state,
185  Wonton::Executor_type const *executor = nullptr,
186  std::string *errmsg = nullptr)
187  : source_mesh_(source_mesh),
188  target_mesh_(target_mesh),
189  source_state_(source_state),
190  target_state_(target_state),
191  dim_(source_mesh.space_dimension()),
192  executor_(executor) {
193 
194  assert(source_mesh.space_dimension() == target_mesh.space_dimension());
195 
196  // if the variables to remap were not listed, assume all variables are
197  // to be remapped
198  if (source_vars_to_remap_.size() == 0)
199  source_vars_to_remap_ = source_state_.names();
200 
201  // Record all the field types we are remapping and all the kinds
202  // of entities we are remapping on
203 
204  entity_kinds_.clear();
205  for (auto const& source_varname : source_vars_to_remap_) {
206  Entity_kind onwhat = source_state_.get_entity(source_varname);
207  if (std::find(entity_kinds_.begin(), entity_kinds_.end(), onwhat) ==
208  entity_kinds_.end())
209  entity_kinds_.push_back(onwhat);
210 
211  Field_type fieldtype = source_state_.field_type(onwhat, source_varname);
212  if (std::find(field_types_.begin(), field_types_.end(), fieldtype) ==
213  field_types_.end())
214  field_types_.push_back(fieldtype);
215 
216  if (fieldtype == Field_type::MULTIMATERIAL_FIELD)
217  have_multi_material_fields_ = true;
218  }
219 
220  // Make the core drivers for each entity kind
221 
222  instantiate_core_drivers();
223  }
224 
225 
227  UberDriver(const UberDriver &) = delete;
228 
230  UberDriver & operator = (const UberDriver &) = delete;
231 
233  UberDriver(UberDriver&&) noexcept = default;
234 
236  ~UberDriver() = default;
237 
239 
240  bool is_distributed_run(Wonton::Executor_type const *executor = nullptr) {
241  distributed_ = false;
242 
243 #ifdef PORTAGE_ENABLE_MPI
244  mycomm_ = MPI_COMM_NULL;
245  auto mpiexecutor = dynamic_cast<Wonton::MPIExecutor_type const *>(executor);
246  if (mpiexecutor && mpiexecutor->mpicomm != MPI_COMM_NULL) {
247  mycomm_ = mpiexecutor->mpicomm;
248  MPI_Comm_size(mycomm_, &nprocs_);
249  if (nprocs_ > 1)
250  distributed_ = true;
251  }
252 #endif
253 
254  return distributed_;
255  }
256 
263  bool source_needs_redistribution(Wonton::Executor_type const *executor =
264  nullptr) {
265  // for now if it is a distributed run, we always "redistribute"
266  // even if that means copying the data into the flat mesh/state
267  // but not moving data around. Eventually, we will determine if
268  // we need to redistribute based on the partition check and
269  // and construct the flat mesh/state wrappers only if we need to
270 
271  return is_distributed_run(executor);
272  }
273 
274 
285  template<
286  template <int, Entity_kind, class, class> class Search,
287  template <Entity_kind, class, class, class,
288  template <class, int, class, class> class,
289  class, class> class Intersect
290  >
292 
293  Portage::vector<std::vector<int>> intersection_candidates;
294 
295  for (Entity_kind onwhat : entity_kinds_) {
296  switch (onwhat) {
297  case CELL: {
298  // find intersection candidates
299  intersection_candidates = search<CELL, Search>();
300 
301  // Compute moments of intersection
302  source_weights_[onwhat] =
303  intersect_meshes<CELL, Intersect>(intersection_candidates);
304 
305  if (have_multi_material_fields_) {
306  mat_intersection_completed_ = true;
307 
308  source_weights_by_mat_ =
309  intersect_materials<Intersect>(intersection_candidates);
310  }
311  break;
312  }
313  case NODE: {
314  // find intersection candidates
315  intersection_candidates = search<NODE, Search>();
316 
317  // Compute moments of intersection
318  source_weights_[onwhat] =
319  intersect_meshes<NODE, Intersect>(intersection_candidates);
320 
321  break;
322  }
323  default:
324  std::cerr << "Cannot remap on " << to_string(onwhat) << "\n";
325  }
326  }
327 
328  }
329 
330 
331 
342  void set_num_tols(const double min_absolute_distance,
343  const double min_absolute_volume) {
344  for (Entity_kind onwhat : entity_kinds_) {
345  switch (onwhat) {
346  case CELL:
347  core_driver_serial_[CELL]->template set_num_tols<CELL>(
348  min_absolute_distance, min_absolute_volume); break;
349  case NODE:
350  core_driver_serial_[NODE]->template set_num_tols<NODE>(
351  min_absolute_distance, min_absolute_volume); break;
352  default:
353  std::cerr << "Cannot remap on " << to_string(onwhat) << "\n";
354 
355  }
356  }
357  }
358 
366  void set_num_tols(const NumericTolerances_t& num_tols) {
367  for (Entity_kind onwhat : entity_kinds_) {
368  switch (onwhat) {
369  case CELL:
370  core_driver_serial_[CELL]->template set_num_tols<CELL>(num_tols); break;
371  case NODE:
372  core_driver_serial_[NODE]->template set_num_tols<NODE>(num_tols); break;
373  default:
374  std::cerr << "Cannot remap on " << to_string(onwhat) << "\n";
375 
376  }
377  }
378  }
379 
391  template<
392  Entity_kind ONWHAT,
393  template <int, Entity_kind, class, class> class Search
394  >
395  Portage::vector<std::vector<int>> // return type
396  search() {
397 
398  search_completed_[ONWHAT] = true;
399 
400  return core_driver_serial_[ONWHAT]->template search<ONWHAT, Search>();
401 
402  }
403 
404 
417  template<
418  Entity_kind ONWHAT,
419  template <Entity_kind, class, class, class,
420  template <class, int, class, class> class,
421  class, class> class Intersect
422  >
423  Portage::vector<std::vector<Portage::Weights_t>> // return type
424  intersect_meshes(Portage::vector<std::vector<int>> const& candidates) {
425 
426 
427  const auto& weights = core_driver_serial_[ONWHAT]->template intersect_meshes<ONWHAT, Intersect>(candidates);
428 
429  // Check the mesh mismatch once, to make sure the mismatch is cached
430  // prior to interpolation with fixup. This is the correct place to automatically do the
431  // check because it reqires the intersection weights which were just computed.
432  core_driver_serial_[ONWHAT]->template check_mismatch<ONWHAT>(weights);
433 
434  mesh_intersection_completed_[ONWHAT] = true;
435 
436  return weights;
437  }
438 
439 #ifdef HAVE_TANGRAM
440 
452  void set_interface_reconstructor_options(bool all_convex,
453  const std::vector<Tangram::IterativeMethodTolerances_t> &tols =
454  std::vector<Tangram::IterativeMethodTolerances_t>()) {
455  core_driver_serial_[CELL]->set_interface_reconstructor_options(all_convex, tols);
456  }
457 
458 #endif
459 
460 
461 
462  /* @brief intersect target cells with source material polygons
463 
464  @tparam Entity_kind what kind of entities are we intersecting
465 
466  @tparam Intersect intersect functor
467 
468  @param[in] candidates intersection candidates for each target cells
469 
470  @returns vector(s) of weights for each target cell organized by
471  material (hence the additional outer std::vector compared to the
472  return type of intersect_meshes)
473  */
474 
475  template<
476  template <Entity_kind, class, class, class,
477  template <class, int, class, class> class,
478  class, class> class Intersect
479  >
480  std::vector<Portage::vector<std::vector<Portage::Weights_t>>>
481  intersect_materials(Portage::vector<std::vector<int>> const& candidates) {
482 
483  mat_intersection_completed_ = true;
484 
485  return core_driver_serial_[CELL]->template intersect_materials<Intersect>(candidates);
486 
487  }
488 
489 
524  template<typename T = double,
525  Entity_kind ONWHAT,
526  template<int, Entity_kind, class, class, class, class, class,
527  template<class, int, class, class> class,
528  class, class, class> class Interpolate
529  >
530  void interpolate(std::string srcvarname,
531  T lower_bound, T upper_bound,
532  Limiter_type limiter = DEFAULT_LIMITER,
534  Partial_fixup_type partial_fixup_type = DEFAULT_PARTIAL_FIXUP_TYPE,
535  Empty_fixup_type empty_fixup_type = DEFAULT_EMPTY_FIXUP_TYPE,
536  double conservation_tol = DEFAULT_NUMERIC_TOLERANCES<D>.relative_conservation_eps,
537  int max_fixup_iter = DEFAULT_NUMERIC_TOLERANCES<D>.max_num_fixup_iter) {
538 
539  interpolate<T, ONWHAT, Interpolate>(srcvarname, srcvarname,
540  lower_bound, upper_bound,
541  limiter, bnd_limiter,
542  partial_fixup_type, empty_fixup_type,
543  conservation_tol, max_fixup_iter);
544  }
545 
578  template<typename T = double,
579  Entity_kind ONWHAT,
580  template<int, Entity_kind, class, class, class, class, class,
581  template<class, int, class, class> class,
582  class, class, class> class Interpolate
583  >
584  void interpolate(std::string srcvarname, std::string trgvarname,
585  T lower_bound, T upper_bound,
586  Limiter_type limiter = DEFAULT_LIMITER,
588  Partial_fixup_type partial_fixup_type = DEFAULT_PARTIAL_FIXUP_TYPE,
589  Empty_fixup_type empty_fixup_type = DEFAULT_EMPTY_FIXUP_TYPE,
590  double conservation_tol = DEFAULT_NUMERIC_TOLERANCES<D>.relative_conservation_eps,
591  int max_fixup_iter = DEFAULT_NUMERIC_TOLERANCES<D>.max_num_fixup_iter) {
592 
593  assert(source_state_.get_entity(srcvarname) == ONWHAT);
594  assert(mesh_intersection_completed_[ONWHAT]);
595 
596  if (std::find(source_vars_to_remap_.begin(), source_vars_to_remap_.end(),
597  srcvarname) == source_vars_to_remap_.end()) {
598  std::cerr << "Cannot remap source variable " << srcvarname <<
599  " - not specified in initial variable list in the constructor \n";
600  return;
601  }
602 
603  if (source_state_.field_type(ONWHAT, srcvarname) ==
604  Field_type::MULTIMATERIAL_FIELD) {
605 
606 #ifdef HAVE_TANGRAM
607  assert(mat_intersection_completed_);
608  assert(ONWHAT == CELL);
609 
610  interpolate_mat_var<T, Interpolate>
611  (srcvarname, trgvarname, source_weights_by_mat_,
612  lower_bound, upper_bound, limiter, bnd_limiter, partial_fixup_type,
613  empty_fixup_type, conservation_tol, max_fixup_iter);
614 #endif
615 
616  } else {
617 
618  assert(mesh_intersection_completed_[ONWHAT]);
619 
620  interpolate_mesh_var<T, ONWHAT, Interpolate>
621  (srcvarname, trgvarname, source_weights_[ONWHAT],
622  lower_bound, upper_bound, limiter, bnd_limiter, partial_fixup_type,
623  empty_fixup_type, conservation_tol, max_fixup_iter);
624  }
625 
626  } // interpolate
627 
668  template<typename T = double,
669  Entity_kind ONWHAT,
670  template<int, Entity_kind, class, class, class, class, class,
671  template <class, int, class, class> class,
672  class, class, class> class Interpolate
673  >
674  void interpolate_mesh_var(std::string srcvarname, std::string trgvarname,
675  Portage::vector<std::vector<Weights_t>> const& sources_and_weights_in,
676  T lower_bound, T upper_bound,
677  Limiter_type limiter,
678  Boundary_Limiter_type bnd_limiter,
679  Partial_fixup_type partial_fixup_type,
680  Empty_fixup_type empty_fixup_type,
681  double conservation_tol,
682  int max_fixup_iter) {
683 
684  assert(source_state_.get_entity(srcvarname) == ONWHAT);
685 
686  if (std::find(source_vars_to_remap_.begin(), source_vars_to_remap_.end(),
687  srcvarname) == source_vars_to_remap_.end()) {
688  std::cerr << "Cannot remap source variable " << srcvarname <<
689  " - not specified in initial variable list in the constructor \n";
690  return;
691  }
692 
693  auto & driver = core_driver_serial_[ONWHAT];
694 
695  using Interpolator = Interpolate<D, ONWHAT,
696  SourceMesh, TargetMesh,
697  SourceState, TargetState,
698  T,
699  InterfaceReconstructorType,
700  Matpoly_Splitter, Matpoly_Clipper,
701  CoordSys>;
702 
703  if (Interpolator::order == 2) {
704  auto gradients = driver->template compute_source_gradient<ONWHAT>(srcvarname,
705  limiter,
706  bnd_limiter);
707 
708  driver->template interpolate_mesh_var<T, ONWHAT, Interpolate>(
709  srcvarname, trgvarname, sources_and_weights_in, &gradients
710  );
711  } else {
712  driver->template interpolate_mesh_var<T, ONWHAT, Interpolate>(
713  srcvarname, trgvarname, sources_and_weights_in
714  );
715  }
716 
717  if (driver->template has_mismatch<ONWHAT>())
718  driver->template fix_mismatch<ONWHAT>(srcvarname, trgvarname, lower_bound, upper_bound, conservation_tol,
719  max_fixup_iter, partial_fixup_type, empty_fixup_type);
720 
721  }
722 
756  template <typename T = double,
757  template<int, Entity_kind, class, class, class, class, class,
758  template <class, int, class, class> class,
759  class, class, class> class Interpolate
760  >
761  void interpolate_mat_var(std::string srcvarname, std::string trgvarname,
762  std::vector<Portage::vector<std::vector<Weights_t>>> const& sources_and_weights_by_mat_in,
763  T lower_bound, T upper_bound,
764  Limiter_type limiter,
765  Boundary_Limiter_type bnd_limiter,
766  Partial_fixup_type partial_fixup_type,
767  Empty_fixup_type empty_fixup_type,
768  double conservation_tol,
769  int max_fixup_iter) {
770 
771  assert(source_state_.get_entity(srcvarname) == CELL);
772 
773  if (std::find(source_vars_to_remap_.begin(), source_vars_to_remap_.end(),
774  srcvarname) == source_vars_to_remap_.end()) {
775  std::cerr << "Cannot remap source variable " << srcvarname <<
776  " - not specified in initial variable list in the constructor \n";
777  return;
778  }
779 
780 #ifdef HAVE_TANGRAM
781  auto & driver = core_driver_serial_[CELL];
782 
783  using Interpolator = Interpolate<D, CELL,
784  SourceMesh, TargetMesh,
785  SourceState, TargetState,
786  T,
787  InterfaceReconstructorType,
788  Matpoly_Splitter, Matpoly_Clipper,
789  CoordSys>;
790 
791  int const nb_mats = source_state_.num_materials();
792  assert(nb_mats > 0);
793 
794  if (Interpolator::order == 2) {
795  std::vector<Portage::vector<Vector<D>>> gradients(nb_mats);
796  for (int i = 0; i < nb_mats; ++i) {
797  gradients[i] = driver->template compute_source_gradient<CELL>(srcvarname,
798  limiter,
799  bnd_limiter, i);
800  }
801  driver->template interpolate_mat_var<T, Interpolate>(
802  srcvarname, trgvarname, sources_and_weights_by_mat_in,
803  &gradients
804  );
805  } else {
806  driver->template interpolate_mat_var<T, Interpolate>(
807  srcvarname, trgvarname, sources_and_weights_by_mat_in
808  );
809  }
810 #endif
811  }
812 
813  private:
814 
815  // Inputs specified by calling app
816  SourceMesh const& source_mesh_;
817  TargetMesh const& target_mesh_;
818  SourceState const& source_state_;
819  TargetState& target_state_;
820  int dim_ = 0;
821 
822  // Component variables
823  bool distributed_ = false; // default is serial
824  Wonton::Executor_type const *executor_;
825 #ifdef PORTAGE_ENABLE_MPI
826  int nprocs_ = 1;
827  MPI_Comm mycomm_ = MPI_COMM_NULL;
828 #endif
829 
830  std::vector<std::string> source_vars_to_remap_ {};
831  std::vector<Entity_kind> entity_kinds_ {};
832  std::vector<Field_type> field_types_ {};
833 
834  // Whether we are remapping multimaterial fields
835  bool have_multi_material_fields_ = false;
836 
837  // Track what steps are completed
838  std::map<Entity_kind, bool> search_completed_ {};
839  std::map<Entity_kind, bool> mesh_intersection_completed_ {};
840  bool mat_intersection_completed_ = false;
841 
842  // Pointers to core drivers designed to work on a particular
843  // entity kind on native mesh/state. These work for serial runs, or
844  // parallel runs where the distribution via flat mesh/state has already
845  // occurred.
846 
847  std::map<Entity_kind, std::unique_ptr<SerialDriverType>> core_driver_serial_ {};
848 
849  // Weights of intersection b/w target entities and source entities
850  // Each intersection is between the control volume (cell, dual cell)
851  // of a target and source entity.
852 
853  // over all entity kinds (CELL, NODE, etc.)
854  // ||
855  // || for all target entities
856  // || of a particular kind
857  // || ||
858  // || || intersection moments list
859  // || || for each target entity
860  // || || ||
861  // \/ \/ \/
862  std::map<Entity_kind, Portage::vector<std::vector<Weights_t>>> source_weights_ {};
863 
864  // Weights of intersection b/w target CELLS and source material polygons
865  // Each intersection is between a target cell and material polygon in
866  // a source cell for a particular material
867 
868  // for each material
869  // ||
870  // || for all target entities
871  // || of a particular kind
872  // || ||
873  // || || intersection moments for
874  // || || each target entity
875  // || || ||
876  // \/ \/ \/
877  std::vector<Portage::vector<std::vector<Weights_t>>> source_weights_by_mat_ {};
878 
886  void instantiate_core_drivers(Wonton::Executor_type const *executor =
887  nullptr) {
888  std::string message;
889 
890  for (auto const& onwhat : entity_kinds_) {
891  search_completed_[onwhat] = false;
892  mesh_intersection_completed_[onwhat] = false;
893  }
894 
895  // Default is serial run (if MPI is not enabled or the
896  // communicator is not defined or the number of processors is 1)
897 
898  for (Entity_kind onwhat : entity_kinds_)
899  core_driver_serial_[onwhat] =
900  make_core_driver<D, SourceMesh, SourceState,
901  TargetMesh, TargetState,
902  InterfaceReconstructorType,
903  Matpoly_Splitter, Matpoly_Clipper, CoordSys
904  >(onwhat,
905  source_mesh_, source_state_,
906  target_mesh_, target_state_, executor_);
907 
908  } // UberDriver::instantiate_core_drivers
909 
910 }; // UberDriver
911 
912 
913 } // namespace Portage
914 
915 #endif // PORTAGE_GENREMAP_DRIVER_H_
UberDriver & operator=(const UberDriver &)=delete
Assignment operator (disabled)
const NumericTolerances_t DEFAULT_NUMERIC_TOLERANCES
Definition: portage.h:186
Portage::vector< std::vector< Portage::Weights_t > > intersect_meshes(Portage::vector< std::vector< int >> const &candidates)
intersect target control volumes with source control volumes
Definition: uberdriver.h:424
Boundary_Limiter_type
Boundary limiter type.
Definition: portage.h:91
constexpr Boundary_Limiter_type DEFAULT_BND_LIMITER
Definition: portage.h:94
void set_num_tols(const double min_absolute_distance, const double min_absolute_volume)
Set numerical tolerances for small distances and volumes in core driver.
Definition: uberdriver.h:342
bool is_distributed_run(Wonton::Executor_type const *executor=nullptr)
Is this a distributed (multi-rank) run?
Definition: uberdriver.h:240
std::vector< T > vector
Definition: portage.h:238
constexpr Empty_fixup_type DEFAULT_EMPTY_FIXUP_TYPE
Definition: portage.h:138
Intersection and other tolerances to handle tiny values.
Definition: portage.h:152
void set_num_tols(const NumericTolerances_t &num_tols)
set numerical tolerances in core driver
Definition: uberdriver.h:366
void interpolate(std::string srcvarname, T lower_bound, T upper_bound, Limiter_type limiter=DEFAULT_LIMITER, Boundary_Limiter_type bnd_limiter=DEFAULT_BND_LIMITER, Partial_fixup_type partial_fixup_type=DEFAULT_PARTIAL_FIXUP_TYPE, Empty_fixup_type empty_fixup_type=DEFAULT_EMPTY_FIXUP_TYPE, double conservation_tol=DEFAULT_NUMERIC_TOLERANCES< D >.relative_conservation_eps, int max_fixup_iter=DEFAULT_NUMERIC_TOLERANCES< D >.max_num_fixup_iter)
Definition: uberdriver.h:530
Partial_fixup_type
Fixup options for partially filled cells.
Definition: portage.h:114
bool source_needs_redistribution(Wonton::Executor_type const *executor=nullptr)
Definition: uberdriver.h:263
void compute_interpolation_weights()
Compute interpolation weights in advance of actual interpolation of variables.
Definition: uberdriver.h:291
Limiter_type
Limiter type.
Definition: portage.h:85
UberDriver provides the API to mapping multi-material data from one mesh to another in a general way...
Definition: uberdriver.h:100
~UberDriver()=default
Destructor.
CoreDriverBase - Base class for core driver that is agnostic to the Entity_kind.
Definition: coredriver.h:105
std::vector< Portage::vector< std::vector< Portage::Weights_t > > > intersect_materials(Portage::vector< std::vector< int >> const &candidates)
Definition: uberdriver.h:481
UberDriver(SourceMesh const &source_mesh, SourceState const &source_state, TargetMesh const &target_mesh, TargetState &target_state, Wonton::Executor_type const *executor=nullptr, std::string *errmsg=nullptr)
Constructor for the remap driver.
Definition: uberdriver.h:181
Definition: coredriver.h:42
UberDriver(SourceMesh const &source_mesh, SourceState const &source_state, TargetMesh const &target_mesh, TargetState &target_state, std::vector< std::string > const &source_vars_to_remap, Wonton::Executor_type const *executor=nullptr, std::string *errmsg=nullptr)
Constructor for the remap driver.
Definition: uberdriver.h:131
constexpr Limiter_type DEFAULT_LIMITER
Definition: portage.h:88
Core driver for remapping.
std::unique_ptr< CoreDriverBase< D, SourceMesh, SourceState, TargetMesh, TargetState, InterfaceReconstructorType, Matpoly_Splitter, Matpoly_Clipper, CoordSys > > make_core_driver(Entity_kind onwhat, SourceMesh const &source_mesh, SourceState const &source_state, TargetMesh const &target_mesh, TargetState &target_state, Wonton::Executor_type const *executor)
Definition: coredriver.h:1524
void interpolate_mat_var(std::string srcvarname, std::string trgvarname, std::vector< Portage::vector< std::vector< Weights_t >>> const &sources_and_weights_by_mat_in, T lower_bound, T upper_bound, Limiter_type limiter, Boundary_Limiter_type bnd_limiter, Partial_fixup_type partial_fixup_type, Empty_fixup_type empty_fixup_type, double conservation_tol, int max_fixup_iter)
Definition: uberdriver.h:761
void Intersect(const IsotheticBBox< D > &box, const KDTree< D > *kdtree, std::vector< int > &pfound)
Definition: kdtree.h:439
std::string to_string(Limiter_type limiter_type)
Definition: portage.h:96
Portage::vector< std::vector< int > > search()
search for candidate source entities whose control volumes (cells, dual cells) overlap the control vo...
Definition: uberdriver.h:396
constexpr Partial_fixup_type DEFAULT_PARTIAL_FIXUP_TYPE
Definition: portage.h:118
Empty_fixup_type
Fixup options for empty cells.
Definition: portage.h:134
void interpolate_mesh_var(std::string srcvarname, std::string trgvarname, Portage::vector< std::vector< Weights_t >> const &sources_and_weights_in, T lower_bound, T upper_bound, Limiter_type limiter, Boundary_Limiter_type bnd_limiter, Partial_fixup_type partial_fixup_type, Empty_fixup_type empty_fixup_type, double conservation_tol, int max_fixup_iter)
Definition: uberdriver.h:674