This class couples data between meshes. More...
#include <Coupler.hpp>
Public Types | |
enum | Method { CONSTANT , LINEAR_FE , QUADRATIC_FE , SPECTRAL , SPHERICAL } |
enum | IntegType { VOLUME } |
Public Member Functions | |
Coupler (Interface *impl, ParallelComm *pc, Range &local_elems, int coupler_id, bool init_tree=true, int max_ent_dim=3) | |
virtual | ~Coupler () |
ErrorCode | initialize_tree () |
Initialize the kdtree, locally and across communicator. More... | |
ErrorCode | locate_points (double *xyz, unsigned int num_points, double rel_eps=0.0, double abs_eps=0.0, TupleList *tl=NULL, bool store_local=true) |
ErrorCode | locate_points (Range &ents, double rel_eps=0.0, double abs_eps=0.0, TupleList *tl=NULL, bool store_local=true) |
ErrorCode | interpolate (Coupler::Method method, Tag tag, double *interp_vals, TupleList *tl=NULL, bool normalize=true) |
ErrorCode | interpolate (Coupler::Method method, const std::string &tag_name, double *interp_vals, TupleList *tl=NULL, bool normalize=true) |
ErrorCode | interpolate (Coupler::Method *methods, const std::string *tag_names, int *points_per_method, int num_methods, double *interp_vals, TupleList *tl=NULL, bool normalize=true) |
ErrorCode | interpolate (Coupler::Method *methods, Tag *tag_names, int *points_per_method, int num_methods, double *interp_vals, TupleList *tl=NULL, bool normalize=true) |
ErrorCode | normalize_mesh (EntityHandle root_set, const char *norm_tag, Coupler::IntegType integ_type, int num_integ_pts) |
ErrorCode | normalize_subset (EntityHandle root_set, const char *norm_tag, const char **tag_names, int num_tags, const char **tag_values, Coupler::IntegType integ_type, int num_integ_pts) |
ErrorCode | normalize_subset (EntityHandle root_set, const char *norm_tag, Tag *tag_handles, int num_tags, const char **tag_values, Coupler::IntegType integ_type, int num_integ_pts) |
ErrorCode | do_normalization (const char *norm_tag, std::vector< std::vector< EntityHandle > > &entity_sets, std::vector< std::vector< EntityHandle > > &entity_groups, Coupler::IntegType integ_type, int num_integ_pts) |
ErrorCode | get_matching_entities (EntityHandle root_set, const char **tag_names, const char **tag_values, int num_tags, std::vector< std::vector< EntityHandle > > *entity_sets, std::vector< std::vector< EntityHandle > > *entity_groups) |
ErrorCode | get_matching_entities (EntityHandle root_set, Tag *tag_handles, const char **tag_values, int num_tags, std::vector< std::vector< EntityHandle > > *entity_sets, std::vector< std::vector< EntityHandle > > *entity_groups) |
ErrorCode | create_tuples (Range &ent_sets, const char **tag_names, unsigned int num_tags, TupleList **tuples) |
ErrorCode | create_tuples (Range &ent_sets, Tag *tag_handles, unsigned int num_tags, TupleList **tuples) |
ErrorCode | consolidate_tuples (TupleList **all_tuples, unsigned int num_tuples, TupleList **unique_tuples) |
ErrorCode | get_group_integ_vals (std::vector< std::vector< EntityHandle > > &groups, std::vector< double > &integ_vals, const char *norm_tag, int num_integ_pts, Coupler::IntegType integ_type) |
ErrorCode | apply_group_norm_factor (std::vector< std::vector< EntityHandle > > &entity_sets, std::vector< double > &norm_factors, const char *norm_tag, Coupler::IntegType integ_type) |
ErrorCode | initialize_spectral_elements (EntityHandle rootSource, EntityHandle rootTarget, bool &specSou, bool &specTar) |
ErrorCode | get_gl_points_on_elements (Range &targ_elems, std::vector< double > &vpos, int &numPointsOfInterest) |
Interface * | mb_impl () const |
AdaptiveKDTree * | my_tree () const |
EntityHandle | local_root () const |
const std::vector< double > & | all_boxes () const |
ParallelComm * | my_pc () const |
const Range & | target_ents () const |
int | my_id () const |
const Range & | my_range () const |
TupleList * | mapped_pts () const |
int | num_its () const |
void | set_spherical (bool arg1=true) |
Private Member Functions | |
ErrorCode | nat_param (double xyz[3], std::vector< EntityHandle > &entities, std::vector< CartVect > &nat_coords, double epsilon=0.0) |
ErrorCode | interp_field (EntityHandle elem, CartVect nat_coord, Tag tag, double &field) |
ErrorCode | constant_interp (EntityHandle elem, Tag tag, double &field) |
ErrorCode | test_local_box (double *xyz, int from_proc, int remote_index, int index, bool &point_located, double rel_eps=0.0, double abs_eps=0.0, TupleList *tl=NULL) |
Private Attributes | |
Interface * | mbImpl |
AdaptiveKDTree * | myTree |
EntityHandle | localRoot |
std::vector< double > | allBoxes |
ParallelComm * | myPc |
int | myId |
Range | myRange |
Range | targetEnts |
TupleList * | mappedPts |
TupleList * | targetPts |
int | numIts |
int | max_dim |
void * | _spectralSource |
void * | _spectralTarget |
moab::Tag | _xm1Tag |
moab::Tag | _ym1Tag |
moab::Tag | _zm1Tag |
int | _ntot |
bool | spherical |
This class couples data between meshes.
The coupler interpolates solution data at a set of points. Data being interpolated resides on a source mesh, in a tag. Applications calling this coupler send in entities, usually points or vertices, and receive back the tag value interpolated at those points. Entities in the source mesh containing those points do not have to reside on the same processor.
To use, an application should:
Multiple interpolations can be done after locating the points.
Definition at line 43 of file Coupler.hpp.
Enumerator | |
---|---|
CONSTANT | |
LINEAR_FE | |
QUADRATIC_FE | |
SPECTRAL | |
SPHERICAL |
Definition at line 46 of file Coupler.hpp.
moab::Coupler::Coupler | ( | Interface * | impl, |
ParallelComm * | pc, | ||
Range & | local_elems, | ||
int | coupler_id, | ||
bool | init_tree = true , |
||
int | max_ent_dim = 3 |
||
) |
Definition at line 47 of file Coupler.cpp.
References _spectralSource, _spectralTarget, moab::Range::empty(), initialize_tree(), mappedPts, myRange, myTree, and targetPts.
|
virtual |
Definition at line 73 of file Coupler.cpp.
References _spectralSource, _spectralTarget, mappedPts, myTree, and targetPts.
|
inline |
ErrorCode moab::Coupler::apply_group_norm_factor | ( | std::vector< std::vector< EntityHandle > > & | entity_sets, |
std::vector< double > & | norm_factors, | ||
const char * | norm_tag, | ||
Coupler::IntegType | integ_type | ||
) |
Definition at line 1785 of file Coupler.cpp.
References ErrorCode, ERRORR, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_SPARSE, MB_TYPE_DOUBLE, mbImpl, moab::Interface::tag_get_handle(), and moab::Interface::tag_set_data().
Referenced by do_normalization(), and main().
ErrorCode moab::Coupler::consolidate_tuples | ( | TupleList ** | all_tuples, |
unsigned int | num_tuples, | ||
TupleList ** | unique_tuples | ||
) |
Definition at line 1561 of file Coupler.cpp.
References moab::TupleList::enableWriteAccess(), moab::TupleList::get_n(), moab::TupleList::getTupleSize(), MB_SUCCESS, moab::TupleList::resize(), moab::TupleList::set_n(), sint, moab::TupleList::sort(), moab::TupleList::vi_rd, and moab::TupleList::vi_wr.
Referenced by get_matching_entities(), and main().
|
private |
Definition at line 1109 of file Coupler.cpp.
References ErrorCode, MB_SUCCESS, mbImpl, and moab::Interface::tag_get_data().
Referenced by interpolate().
ErrorCode moab::Coupler::create_tuples | ( | Range & | ent_sets, |
const char ** | tag_names, | ||
unsigned int | num_tags, | ||
TupleList ** | tuples | ||
) |
Definition at line 1504 of file Coupler.cpp.
References ErrorCode, ERRORR, MB_TAG_ANY, MB_TYPE_DOUBLE, mbImpl, and moab::Interface::tag_get_handle().
Referenced by get_matching_entities(), and main().
ErrorCode moab::Coupler::create_tuples | ( | Range & | ent_sets, |
Tag * | tag_handles, | ||
unsigned int | num_tags, | ||
TupleList ** | tuples | ||
) |
Definition at line 1526 of file Coupler.cpp.
References moab::TupleList::disableWriteAccess(), moab::TupleList::enableWriteAccess(), ErrorCode, ERRORR, moab::TupleList::getTupleSize(), moab::TupleList::inc_n(), MB_SUCCESS, mbImpl, moab::Range::size(), moab::Interface::tag_get_data(), and moab::TupleList::vi_wr.
ErrorCode moab::Coupler::do_normalization | ( | const char * | norm_tag, |
std::vector< std::vector< EntityHandle > > & | entity_sets, | ||
std::vector< std::vector< EntityHandle > > & | entity_groups, | ||
Coupler::IntegType | integ_type, | ||
int | num_integ_pts | ||
) |
Definition at line 1201 of file Coupler.cpp.
References apply_group_norm_factor(), ErrorCode, ERRORMPI, ERRORR, get_group_integ_vals(), MASTER_PROC, myPc, moab::ProcConfig::proc_comm(), and moab::ParallelComm::proc_config().
Referenced by normalize_mesh(), and normalize_subset().
ErrorCode moab::Coupler::get_gl_points_on_elements | ( | Range & | targ_elems, |
std::vector< double > & | vpos, | ||
int & | numPointsOfInterest | ||
) |
Definition at line 1928 of file Coupler.cpp.
References _ntot, _xm1Tag, _ym1Tag, _zm1Tag, moab::Range::begin(), moab::Range::end(), ErrorCode, MB_SUCCESS, mbImpl, moab::Range::size(), and moab::Interface::tag_get_by_ptr().
ErrorCode moab::Coupler::get_group_integ_vals | ( | std::vector< std::vector< EntityHandle > > & | groups, |
std::vector< double > & | integ_vals, | ||
const char * | norm_tag, | ||
int | num_integ_pts, | ||
Coupler::IntegType | integ_type | ||
) |
Definition at line 1650 of file Coupler.cpp.
References ErrorCode, ERRORR, moab::Interface::get_connectivity(), moab::Interface::get_coords(), moab::Element::Map::integrate_scalar_field(), MB_SUCCESS, MB_TAG_CREAT, MB_TAG_SPARSE, MB_TYPE_DOUBLE, MB_UNSUPPORTED_OPERATION, MBEDGE, MBENTITYSET, MBHEX, mbImpl, MBQUAD, MBTET, moab::Interface::tag_get_data(), moab::Interface::tag_get_handle(), moab::Interface::type_from_handle(), and VOLUME.
Referenced by do_normalization(), and main().
ErrorCode moab::Coupler::get_matching_entities | ( | EntityHandle | root_set, |
const char ** | tag_names, | ||
const char ** | tag_values, | ||
int | num_tags, | ||
std::vector< std::vector< EntityHandle > > * | entity_sets, | ||
std::vector< std::vector< EntityHandle > > * | entity_groups | ||
) |
Definition at line 1291 of file Coupler.cpp.
References ErrorCode, ERRORR, MB_TAG_ANY, MB_TYPE_DOUBLE, mbImpl, and moab::Interface::tag_get_handle().
Referenced by main(), and normalize_subset().
ErrorCode moab::Coupler::get_matching_entities | ( | EntityHandle | root_set, |
Tag * | tag_handles, | ||
const char ** | tag_values, | ||
int | num_tags, | ||
std::vector< std::vector< EntityHandle > > * | entity_sets, | ||
std::vector< std::vector< EntityHandle > > * | entity_groups | ||
) |
Definition at line 1313 of file Coupler.cpp.
References moab::Range::clear(), consolidate_tuples(), create_tuples(), moab::debug, ErrorCode, ERRORMPI, ERRORR, moab::Interface::get_entities_by_handle(), moab::Interface::get_entities_by_type_and_tag(), moab::TupleList::get_n(), moab::TupleList::getTupleSize(), moab::Interface::INTERSECT, MASTER_PROC, MBENTITYSET, mbImpl, myPc, moab::pack_tuples(), moab::ProcConfig::proc_comm(), moab::ParallelComm::proc_config(), moab::TupleList::reset(), moab::Range::size(), moab::unpack_tuples(), and moab::TupleList::vi_rd.
ErrorCode moab::Coupler::initialize_spectral_elements | ( | EntityHandle | rootSource, |
EntityHandle | rootTarget, | ||
bool & | specSou, | ||
bool & | specTar | ||
) |
Definition at line 196 of file Coupler.cpp.
References _ntot, _spectralSource, _spectralTarget, _xm1Tag, _ym1Tag, _zm1Tag, moab::Range::empty(), ErrorCode, moab::Interface::get_entities_by_type_and_tag(), MB_SUCCESS, MB_TYPE_DOUBLE, MB_TYPE_INTEGER, MBENTITYSET, mbImpl, moab::Interface::tag_get_data(), and moab::Interface::tag_get_handle().
ErrorCode moab::Coupler::initialize_tree | ( | ) |
Initialize the kdtree, locally and across communicator.
Definition at line 83 of file Coupler.cpp.
References allBoxes, moab::BoundBox::bMax, moab::BoundBox::bMin, moab::AdaptiveKDTree::build_tree(), moab::Range::empty(), ErrorCode, moab::CartVect::get(), moab::Tree::get_bounding_box(), moab::Interface::get_connectivity(), moab::Interface::get_coords(), moab::AdaptiveKDTree::get_info(), moab::ParallelComm::get_part_entities(), moab::CartVect::length(), localRoot, max_dim, MB_SUCCESS, mbImpl, myPc, myRange, myTree, numIts, moab::ProcConfig::proc_comm(), moab::ParallelComm::proc_config(), moab::ProcConfig::proc_rank(), moab::ProcConfig::proc_size(), and spherical.
Referenced by Coupler().
|
private |
Definition at line 1019 of file Coupler.cpp.
References _spectralSource, ErrorCode, moab::Element::SpectralHex::evaluate_scalar_field(), moab::Element::Map::evaluate_scalar_field(), moab::Interface::get_connectivity(), MB_SUCCESS, MBHEX, mbImpl, MBQUAD, MBTET, MBTRI, moab::Interface::tag_get_by_ptr(), moab::Interface::tag_get_data(), and moab::Interface::type_from_handle().
Referenced by interpolate().
ErrorCode moab::Coupler::interpolate | ( | Coupler::Method * | methods, |
const std::string * | tag_names, | ||
int * | points_per_method, | ||
int | num_methods, | ||
double * | interp_vals, | ||
TupleList * | tl = NULL , |
||
bool | normalize = true |
||
) |
ErrorCode moab::Coupler::interpolate | ( | Coupler::Method * | methods, |
Tag * | tag_names, | ||
int * | points_per_method, | ||
int | num_methods, | ||
double * | interp_vals, | ||
TupleList * | tl = NULL , |
||
bool | normalize = true |
||
) |
Definition at line 663 of file Coupler.cpp.
References CONSTANT, constant_interp(), moab::ProcConfig::crystal_router(), moab::TupleList::enableWriteAccess(), ErrorCode, moab::TupleList::get_n(), moab::TupleList::inc_n(), moab::TupleList::initialize(), interp_field(), LINEAR_FE, mappedPts, MB_SUCCESS, myPc, moab::ParallelComm::proc_config(), QUADRATIC_FE, SPHERICAL, targetPts, moab::TupleList::vi_rd, moab::TupleList::vi_wr, moab::TupleList::vr_rd, moab::TupleList::vr_wr, and moab::TupleList::vul_rd.
ErrorCode moab::Coupler::interpolate | ( | Coupler::Method | method, |
const std::string & | tag_name, | ||
double * | interp_vals, | ||
TupleList * | tl = NULL , |
||
bool | normalize = true |
||
) |
Definition at line 643 of file Coupler.cpp.
References _ntot, _spectralSource, ErrorCode, interpolate(), MB_CHK_SET_ERR, MB_TYPE_DOUBLE, mbImpl, normalize(), and moab::Interface::tag_get_handle().
|
inline |
Definition at line 565 of file Coupler.hpp.
References moab::TupleList::get_n(), normalize(), and targetPts.
Referenced by interpolate(), and main().
|
inline |
ErrorCode moab::Coupler::locate_points | ( | double * | xyz, |
unsigned int | num_points, | ||
double | rel_eps = 0.0 , |
||
double | abs_eps = 0.0 , |
||
TupleList * | tl = NULL , |
||
bool | store_local = true |
||
) |
Definition at line 319 of file Coupler.cpp.
References allBoxes, moab::ProcConfig::crystal_router(), moab::TupleList::disableWriteAccess(), moab::BoundBox::distance(), moab::TupleList::enableWriteAccess(), ErrorCode, moab::TupleList::get_max(), moab::TupleList::get_n(), moab::TupleList::inc_n(), moab::TupleList::initialize(), mappedPts, MB_SUCCESS, myPc, moab::ParallelComm::proc_config(), moab::ProcConfig::proc_rank(), moab::ProcConfig::proc_size(), moab::TupleList::reset(), moab::TupleList::resize(), moab::TupleList::set_n(), targetPts, test_local_box(), moab::TupleList::vi_rd, moab::TupleList::vi_wr, and moab::TupleList::vr_wr.
Referenced by locate_points(), and main().
ErrorCode moab::Coupler::locate_points | ( | Range & | ents, |
double | rel_eps = 0.0 , |
||
double | abs_eps = 0.0 , |
||
TupleList * | tl = NULL , |
||
bool | store_local = true |
||
) |
Definition at line 278 of file Coupler.cpp.
References moab::Range::begin(), moab::Range::end(), ErrorCode, moab::Interface::get_connectivity(), moab::Interface::get_coords(), locate_points(), moab::CN::MAX_NODES_PER_ELEMENT, MB_SUCCESS, mbImpl, MBVERTEX, moab::Range::size(), moab::Range::subset_by_type(), moab::subtract(), and targetEnts.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Definition at line 747 of file Coupler.cpp.
References _spectralSource, _xm1Tag, _ym1Tag, _zm1Tag, moab::Range::begin(), moab::AdaptiveKDTree::distance_search(), moab::Range::end(), entities, ErrorCode, moab::Interface::get_connectivity(), moab::Interface::get_coords(), moab::Interface::get_entities_by_dimension(), moab::AdaptiveKDTree::get_tree_iterator(), moab::AdaptiveKDTreeIter::handle(), moab::Interface::id_from_handle(), moab::Element::Map::ievaluate(), moab::Element::LinearTet::ievaluate(), moab::Element::SpectralHex::ievaluate(), moab::Element::SphericalQuad::ievaluate(), moab::Element::SphericalTri::ievaluate(), moab::Element::Map::inside_box(), moab::Element::LinearHex::inside_nat_space(), moab::Element::QuadraticHex::inside_nat_space(), moab::Element::LinearTet::inside_nat_space(), moab::Element::SpectralHex::inside_nat_space(), moab::Element::LinearQuad::inside_nat_space(), moab::Element::LinearTri::inside_nat_space(), moab::Element::LinearEdge::inside_nat_space(), localRoot, max_dim, MB_ENTITY_NOT_FOUND, MB_SUCCESS, MBEDGE, MBHEX, mbImpl, MBQUAD, MBTET, MBTRI, myTree, moab::AdaptiveKDTree::point_search(), moab::Element::SpectralHex::set_gl_points(), spherical, moab::Interface::tag_get_by_ptr(), and moab::Interface::type_from_handle().
Referenced by test_local_box().
ErrorCode moab::Coupler::normalize_mesh | ( | EntityHandle | root_set, |
const char * | norm_tag, | ||
Coupler::IntegType | integ_type, | ||
int | num_integ_pts | ||
) |
Definition at line 1123 of file Coupler.cpp.
References do_normalization(), entities, ErrorCode, ERRORR, moab::Interface::get_entities_by_handle(), and mbImpl.
ErrorCode moab::Coupler::normalize_subset | ( | EntityHandle | root_set, |
const char * | norm_tag, | ||
const char ** | tag_names, | ||
int | num_tags, | ||
const char ** | tag_values, | ||
Coupler::IntegType | integ_type, | ||
int | num_integ_pts | ||
) |
Definition at line 1154 of file Coupler.cpp.
References ErrorCode, ERRORR, MB_TAG_ANY, MB_TYPE_DOUBLE, mbImpl, and moab::Interface::tag_get_handle().
Referenced by main().
ErrorCode moab::Coupler::normalize_subset | ( | EntityHandle | root_set, |
const char * | norm_tag, | ||
Tag * | tag_handles, | ||
int | num_tags, | ||
const char ** | tag_values, | ||
Coupler::IntegType | integ_type, | ||
int | num_integ_pts | ||
) |
Definition at line 1177 of file Coupler.cpp.
References do_normalization(), ErrorCode, ERRORR, and get_matching_entities().
|
inline |
|
inline |
|
inline |
Definition at line 449 of file Coupler.hpp.
References targetEnts.
|
private |
Definition at line 562 of file Coupler.cpp.
References moab::BoundBox::diagonal_length(), moab::TupleList::disableWriteAccess(), moab::TupleList::enableWriteAccess(), entities, ErrorCode, moab::Tree::get_bounding_box(), moab::TupleList::get_max(), moab::TupleList::get_n(), moab::TupleList::get_writeEnabled(), moab::TupleList::inc_n(), localRoot, mappedPts, MB_SUCCESS, myTree, nat_param(), moab::TupleList::resize(), moab::TupleList::vi_wr, moab::TupleList::vr_wr, and moab::TupleList::vul_wr.
Referenced by locate_points().
|
private |
Definition at line 559 of file Coupler.hpp.
Referenced by get_gl_points_on_elements(), initialize_spectral_elements(), and interpolate().
|
private |
Definition at line 556 of file Coupler.hpp.
Referenced by Coupler(), initialize_spectral_elements(), interp_field(), interpolate(), nat_param(), and ~Coupler().
|
private |
Definition at line 557 of file Coupler.hpp.
Referenced by Coupler(), initialize_spectral_elements(), and ~Coupler().
|
private |
Definition at line 558 of file Coupler.hpp.
Referenced by get_gl_points_on_elements(), initialize_spectral_elements(), and nat_param().
|
private |
Definition at line 558 of file Coupler.hpp.
Referenced by get_gl_points_on_elements(), initialize_spectral_elements(), and nat_param().
|
private |
Definition at line 558 of file Coupler.hpp.
Referenced by get_gl_points_on_elements(), initialize_spectral_elements(), and nat_param().
|
private |
Definition at line 510 of file Coupler.hpp.
Referenced by all_boxes(), initialize_tree(), and locate_points().
|
private |
Definition at line 506 of file Coupler.hpp.
Referenced by initialize_tree(), local_root(), nat_param(), and test_local_box().
|
private |
Definition at line 534 of file Coupler.hpp.
Referenced by Coupler(), interpolate(), locate_points(), mapped_pts(), test_local_box(), and ~Coupler().
|
private |
Definition at line 551 of file Coupler.hpp.
Referenced by initialize_tree(), and nat_param().
|
private |
Definition at line 498 of file Coupler.hpp.
Referenced by apply_group_norm_factor(), constant_interp(), create_tuples(), get_gl_points_on_elements(), get_group_integ_vals(), get_matching_entities(), initialize_spectral_elements(), initialize_tree(), interp_field(), interpolate(), locate_points(), mb_impl(), nat_param(), normalize_mesh(), and normalize_subset().
|
private |
Definition at line 518 of file Coupler.hpp.
Referenced by my_id().
|
private |
Definition at line 514 of file Coupler.hpp.
Referenced by do_normalization(), get_matching_entities(), initialize_tree(), interpolate(), locate_points(), and my_pc().
|
private |
Definition at line 522 of file Coupler.hpp.
Referenced by Coupler(), initialize_tree(), and my_range().
|
private |
Definition at line 502 of file Coupler.hpp.
Referenced by Coupler(), initialize_tree(), my_tree(), nat_param(), test_local_box(), and ~Coupler().
|
private |
Definition at line 548 of file Coupler.hpp.
Referenced by initialize_tree(), and num_its().
|
private |
Definition at line 562 of file Coupler.hpp.
Referenced by initialize_tree(), nat_param(), and set_spherical().
|
private |
Definition at line 526 of file Coupler.hpp.
Referenced by locate_points(), and target_ents().
|
private |
Definition at line 543 of file Coupler.hpp.
Referenced by Coupler(), interpolate(), locate_points(), and ~Coupler().