Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::TempestRemapper Class Reference

#include <TempestRemapper.hpp>

+ Inheritance diagram for moab::TempestRemapper:
+ Collaboration diagram for moab::TempestRemapper:

Public Types

enum  TempestMeshType {
  DEFAULT = -1 , CS = 0 , RLL = 1 , ICO = 2 ,
  ICOD = 3 , OVERLAP_FILES = 4 , OVERLAP_MEMORY = 5 , OVERLAP_MOAB = 6
}
 
- Public Types inherited from moab::Remapper
enum  IntersectionContext {
  DEFAULT = -1 , SourceMesh = 0 , TargetMesh = 1 , OverlapMesh = 2 ,
  CoveringMesh = 3
}
 

Public Member Functions

 TempestRemapper (moab::Interface *mbInt, bool offlineMode=false)
 
virtual ~TempestRemapper ()
 
virtual ErrorCode initialize (bool initialize_fsets=true)
 Initialize the TempestRemapper object internal data structures including the mesh sets and TempestRemap mesh references. More...
 
virtual ErrorCode clear ()
 Deallocate and clear any memory initialized in the TempestRemapper object. More...
 
moab::ErrorCode GenerateMesh (Remapper::IntersectionContext ctx, TempestMeshType type)
 Generate a mesh in memory of given type (CS/RLL/ICO/MPAS(structured)) and store it under the context specified by the user. More...
 
moab::ErrorCode LoadMesh (Remapper::IntersectionContext ctx, std::string inputFilename, TempestMeshType type)
 Load a mesh from disk of given type and store it under the context specified by the user. More...
 
moab::ErrorCode ConstructCoveringSet (double tolerance=1e-8, double radius_src=1.0, double radius_tgt=1.0, double boxeps=0.1, bool regional_mesh=false, bool gnomonic=true, int nb_ghost_layers=0)
 Construct a source covering mesh such that it completely encompasses the target grid in parallel. This operation is critical to ensure that the parallel advancing-front intersection algorithm can compute the intersection mesh only locally without any process communication. More...
 
moab::ErrorCode ComputeOverlapMesh (bool kdtree_search=true, bool use_tempest=false)
 Compute the intersection mesh between the source and target grids that have been instantiated in the Remapper. This function invokes the parallel advancing-front intersection algorithm internally for spherical meshes and can handle arbitrary unstructured grids (CS, RLL, ICO, MPAS) with and without holes. More...
 
moab::ErrorCode ConvertTempestMesh (Remapper::IntersectionContext ctx)
 Convert the TempestRemap mesh object to a corresponding MOAB mesh representation according to the intersection context. More...
 
moab::ErrorCode ConvertMeshToTempest (Remapper::IntersectionContext ctx)
 Convert the MOAB mesh representation to a corresponding TempestRemap mesh object according to the intersection context. More...
 
Mesh * GetMesh (Remapper::IntersectionContext ctx)
 Get the TempestRemap mesh object according to the intersection context. More...
 
void SetMesh (Remapper::IntersectionContext ctx, Mesh *mesh, bool overwrite=true)
 Set the TempestRemap mesh object according to the intersection context. More...
 
void SetMeshSet (Remapper::IntersectionContext ctx, moab::EntityHandle mset, moab::Range *entities=nullptr)
 Set the mesh set according to the intersection context. More...
 
Mesh * GetCoveringMesh ()
 Get the covering mesh (TempestRemap) object. More...
 
moab::EntityHandleGetMeshSet (Remapper::IntersectionContext ctx)
 Get the MOAB mesh set corresponding to the intersection context. More...
 
moab::EntityHandle GetMeshSet (Remapper::IntersectionContext ctx) const
 Const overload. Get the MOAB mesh set corresponding to the intersection context. More...
 
moab::RangeGetMeshEntities (Remapper::IntersectionContext ctx)
 Get the mesh element entities corresponding to the intersection context. More...
 
const moab::RangeGetMeshEntities (Remapper::IntersectionContext ctx) const
 Const overload. Get the mesh element entities corresponding to the intersection context. More...
 
moab::RangeGetMeshVertices (Remapper::IntersectionContext ctx)
 Get the mesh vertices corresponding to the intersection context. Useful for point-cloud meshes. More...
 
const moab::RangeGetMeshVertices (Remapper::IntersectionContext ctx) const
 Const overload. Get the mesh vertices corresponding to the intersection context. Useful for point-cloud meshes. More...
 
moab::EntityHandleGetCoveringSet ()
 Get access to the underlying source covering set if available. Else return the source set. More...
 
void SetMeshType (Remapper::IntersectionContext ctx, const std::vector< int > &metadata)
 Set the mesh type corresponding to the intersection context. More...
 
void ResetMeshSet (Remapper::IntersectionContext ctx, moab::EntityHandle meshSet)
 Reconstruct mesh, used now only for IO; need a better solution maybe. More...
 
TempestMeshType GetMeshType (Remapper::IntersectionContext ctx) const
 Get the mesh type corresponding to the intersection context. More...
 
moab::ErrorCode WriteTempestIntersectionMesh (std::string strOutputFileName, const bool fAllParallel, const bool fInputConcave, const bool fOutputConcave)
 Gather the overlap mesh and associated source/target data and write it out to disk using the TempestRemap output interface. This information can then be used with the "GenerateOfflineMap" tool in TempestRemap as needed. More...
 
moab::ErrorCode GenerateCSMeshMetadata (const int ntot_elements, moab::Range &entities, moab::Range *secondary_entities, const std::string &dofTagName, int nP)
 Generate the necessary metadata and specifically the GLL node numbering for DoFs for a CS mesh. This negates the need for running external code like HOMME to output the numbering needed for computing maps. The functionality is used through the mbconvert tool to compute processor-invariant Global DoF IDs at GLL nodes. More...
 
moab::ErrorCode GenerateMeshMetadata (Mesh &mesh, const int ntot_elements, moab::Range &entities, moab::Range *secondary_entities, const std::string dofTagName, int nP)
 Generate the necessary metadata for DoF node numbering in a given mesh. Currently, only the functionality to generate numbering on CS grids is supported. More...
 
moab::ErrorCode GetOverlapAugmentedEntities (moab::Range &sharedGhostEntities)
 Get all the ghosted overlap entities that were accumulated to enable conservation in parallel. More...
 
moab::ErrorCode assign_vertex_element_IDs (Tag idtag, EntityHandle this_set, const int dimension=2, const int start_id=1)
 Internal method to assign vertex and element global IDs if one does not exist already. More...
 
ErrorCode GetIMasks (Remapper::IntersectionContext ctx, std::vector< int > &masks)
 Get the masks that could have been defined. More...
 
- Public Member Functions inherited from moab::Remapper
 Remapper (moab::Interface *mbInt)
 
virtual ~Remapper ()
 
moab::Interfaceget_interface ()
 
ErrorCode LoadNativeMesh (std::string filename, moab::EntityHandle &meshset, std::vector< int > &metadata, const char *readopts=0)
 

Public Attributes

const bool offlineWorkflow
 Flag indicating whether the workflow is in offline mode. More...
 
bool meshValidate
 Flag to enable mesh validation after loading from file. More...
 
bool constructEdgeMap
 Flag to construct the edge map within the TempestRemap data structures. More...
 

Static Public Attributes

static const bool verbose = true
 Global verbosity flag. More...
 

Private Member Functions

ErrorCode ConvertAllMeshesToTempest ()
 Convert all MOAB meshes to TempestRemap format. More...
 
moab::ErrorCode ConvertOverlapMeshSourceOrdered ()
 Convert overlap mesh to source-ordered format. More...
 
moab::ErrorCode load_tempest_mesh_private (std::string inputFilename, Mesh **tempest_mesh)
 Load a mesh from disk in TempestRemap format. More...
 
moab::ErrorCode convert_mesh_to_tempest_private (Mesh *mesh, moab::EntityHandle meshset, moab::Range &entities, moab::Range *pverts)
 Convert a MOAB mesh to TempestRemap format. More...
 
moab::ErrorCode convert_tempest_mesh_private (TempestMeshType type, Mesh *mesh, moab::EntityHandle &meshset, moab::Range &entities, moab::Range *vertices)
 Convert a TempestRemap mesh to MOAB format. More...
 
moab::ErrorCode AugmentOverlapSet ()
 Augment overlap mesh with ghosted entities. More...
 

Private Attributes

Mesh * m_source
 
TempestMeshType m_source_type
 
moab::Range m_source_entities
 
moab::Range m_source_vertices
 
moab::EntityHandle m_source_set
 
int max_source_edges
 
bool point_cloud_source
 
std::vector< int > m_source_metadata
 
Mesh * m_target
 
TempestMeshType m_target_type
 
moab::Range m_target_entities
 
moab::Range m_target_vertices
 
moab::EntityHandle m_target_set
 
int max_target_edges
 
bool point_cloud_target
 
std::vector< int > m_target_metadata
 
Mesh * m_overlap
 
TempestMeshType m_overlap_type
 
moab::Range m_overlap_entities
 
moab::EntityHandle m_overlap_set
 
std::vector< std::pair< int, int > > m_sorted_overlap_order
 
moab::Intx2MeshOnSpherembintx
 
Mesh * m_covering_source
 
moab::EntityHandle m_covering_source_set
 
moab::Range m_covering_source_entities
 
moab::Range m_covering_source_vertices
 
IntxAreaUtils::AreaMethod m_area_method
 
bool rrmgrids
 
bool is_parallel
 
bool is_root
 
int rank
 
int size
 

Friends

class TempestOnlineMap
 

Additional Inherited Members

- Protected Attributes inherited from moab::Remapper
Interfacem_interface
 

Detailed Description

Definition at line 36 of file TempestRemapper.hpp.

Member Enumeration Documentation

◆ TempestMeshType

Enumerator
DEFAULT 
CS 
RLL 
ICO 
ICOD 
OVERLAP_FILES 
OVERLAP_MEMORY 
OVERLAP_MOAB 

Definition at line 54 of file TempestRemapper.hpp.

55  {
56  DEFAULT = -1,
57  CS = 0,
58  RLL = 1,
59  ICO = 2,
60  ICOD = 3,
61  OVERLAP_FILES = 4,
62  OVERLAP_MEMORY = 5,
63  OVERLAP_MOAB = 6
64  };

Constructor & Destructor Documentation

◆ TempestRemapper()

moab::TempestRemapper::TempestRemapper ( moab::Interface mbInt,
bool  offlineMode = false 
)
inline

Definition at line 43 of file TempestRemapper.hpp.

44  : Remapper( mbInt ),
45 #endif
46  offlineWorkflow( offlineMode ), meshValidate( false ), constructEdgeMap( false ), m_source_type( DEFAULT ),
48  {
49  }

◆ ~TempestRemapper()

moab::TempestRemapper::~TempestRemapper ( )
virtual

Definition at line 101 of file TempestRemapper.cpp.

102 {
103  this->clear();
104 }

References clear().

Member Function Documentation

◆ assign_vertex_element_IDs()

ErrorCode moab::TempestRemapper::assign_vertex_element_IDs ( Tag  idtag,
EntityHandle  this_set,
const int  dimension = 2,
const int  start_id = 1 
)

Internal method to assign vertex and element global IDs if one does not exist already.

Parameters
idtagTag for the global IDs
this_setMOAB entity handle of the mesh set
dimensionDimension of the mesh (default: 2)
start_idStarting ID (default: 1)
Returns
ErrorCode indicating the status of the assignment

Definition at line 1000 of file TempestRemapper.cpp.

1004 {
1005  assert( idtag );
1006 
1007  ErrorCode rval;
1008  Range entities;
1009  rval = m_interface->get_entities_by_dimension( this_set, dimension, entities );MB_CHK_SET_ERR( rval, "Failed to get entities" );
1010 
1011  if( entities.size() == 0 ) return moab::MB_SUCCESS;
1012 
1013  int idoffset = start_id;
1014  std::vector< int > gid( entities.size() );
1015  for( unsigned i = 0; i < entities.size(); ++i )
1016  gid[i] = idoffset++;
1017 
1018  rval = m_interface->tag_set_data( idtag, entities, &gid[0] );MB_CHK_ERR( rval );
1019 
1020  return moab::MB_SUCCESS;
1021 }

References entities, ErrorCode, moab::Interface::get_entities_by_dimension(), moab::Remapper::m_interface, MB_CHK_ERR, MB_CHK_SET_ERR, MB_SUCCESS, and moab::Interface::tag_set_data().

Referenced by main().

◆ AugmentOverlapSet()

moab::ErrorCode moab::TempestRemapper::AugmentOverlapSet ( )
private

Augment overlap mesh with ghosted entities.

Adds ghosted entities to the overlap mesh to ensure conservation in parallel operations.

Returns
moab::ErrorCode Status of the augmentation

Referenced by ComputeOverlapMesh().

◆ clear()

ErrorCode moab::TempestRemapper::clear ( )
virtual

Deallocate and clear any memory initialized in the TempestRemapper object.

Returns
ErrorCode indicating the status of the clear operation

Definition at line 106 of file TempestRemapper.cpp.

107 {
108  // destroy all meshes
109  if( m_source )
110  {
111  delete m_source;
112  m_source = nullptr;
113  }
114  if( m_target )
115  {
116  delete m_target;
117  m_target = nullptr;
118  }
119  if( m_overlap )
120  {
121  delete m_overlap;
122  m_overlap = nullptr;
123  }
124  if( m_covering_source && size > 1 )
125  {
126  delete m_covering_source;
127  m_covering_source = nullptr;
128  }
129 
130  point_cloud_source = false;
131  point_cloud_target = false;
132 
140  // gid_to_lid_src.clear();
141  // gid_to_lid_tgt.clear();
142  // gid_to_lid_covsrc.clear();
143  // lid_to_gid_src.clear();
144  // lid_to_gid_tgt.clear();
145  // lid_to_gid_covsrc.clear();
146 
147  return MB_SUCCESS;
148 }

References moab::Range::clear(), m_covering_source, m_covering_source_entities, m_covering_source_vertices, m_overlap, m_overlap_entities, m_source, m_source_entities, m_source_vertices, m_target, m_target_entities, m_target_vertices, MB_SUCCESS, point_cloud_source, point_cloud_target, and size.

Referenced by main(), and ~TempestRemapper().

◆ ComputeOverlapMesh()

ErrorCode moab::TempestRemapper::ComputeOverlapMesh ( bool  kdtree_search = true,
bool  use_tempest = false 
)

Compute the intersection mesh between the source and target grids that have been instantiated in the Remapper. This function invokes the parallel advancing-front intersection algorithm internally for spherical meshes and can handle arbitrary unstructured grids (CS, RLL, ICO, MPAS) with and without holes.

Parameters
kdtree_searchFlag to enable k-d tree search (default: true)
use_tempestFlag to use TempestRemap (default: false)
Returns
ErrorCode indicating the status of the intersection mesh computation

Definition at line 1360 of file TempestRemapper.cpp.

1361 {
1362  ErrorCode rval;
1363  const bool outputEnabled = ( this->rank == 0 );
1364  moab::DebugOutput dbgprint( std::cout, this->rank, 0 );
1365  dbgprint.set_prefix( "[ComputeOverlapMesh]: " );
1366 
1367  //
1368  // Create the intersection on the sphere object and set up necessary parameters
1369  //
1370  // First, split based on whether to use TempestRemap or MOAB for intersection
1371  // If TempestRemap,
1372  // 1) Check for valid Mesh and pointers to objects for source/target
1373  // 2) Invoke GenerateOverlapWithMeshes routine from Tempest library
1374  // If MOAB,
1375  // 1) Check for valid source and target meshsets (and entities)
1376  // 2) Build processor bounding boxes and construct a covering set
1377  // 3) Perform intersection between the source (covering) and target entities
1378  if( use_tempest )
1379  {
1380  // Now let us construct the overlap mesh, by calling TempestRemap interface directly
1381  // For the overlap method, choose between: "fuzzy", "exact" or "mixed"
1382  assert( m_covering_source != nullptr );
1383  assert( m_target != nullptr );
1384  if( m_overlap != nullptr ) delete m_overlap;
1385  bool concaveMeshA = false, concaveMeshB = false;
1386  // we have reset the overlap mesh - allocate now
1387  m_overlap = new Mesh();
1388  // Generate the overlap mesh using TempestRemap
1389  if( GenerateOverlapWithMeshes( *m_covering_source, *m_target, *m_overlap, "" /*outFilename*/, "Netcdf4",
1390  "exact", concaveMeshA, concaveMeshB, true, false ) )
1391  MB_CHK_SET_ERR( MB_FAILURE, "TempestRemap: cannot compute the intersection of meshes on the sphere" );
1392  }
1393  else
1394  {
1395  // Now perform the actual parallel intersection between the source and the target meshes
1396  if( kdtree_search )
1397  {
1398  if( outputEnabled ) dbgprint.printf( 0, "Computing intersection mesh with the Kd-tree search algorithm" );
1399  rval = mbintx->intersect_meshes_kdtree( m_covering_source_set, m_target_set, m_overlap_set );MB_CHK_SET_ERR( rval, "Can't compute the intersection of meshes on the sphere with brute-force" );
1400  }
1401  else
1402  {
1403  if( outputEnabled )
1404  dbgprint.printf( 0, "Computing intersection mesh with the advancing-front propagation algorithm" );
1405  rval = mbintx->intersect_meshes( m_covering_source_set, m_target_set, m_overlap_set );MB_CHK_SET_ERR( rval, "Can't compute the intersection of meshes on the sphere" );
1406  }
1407 
1408 #ifdef MOAB_HAVE_MPI
1409  if( is_parallel || rrmgrids )
1410  {
1411 #ifdef VERBOSE
1412  std::stringstream ffc, fft, ffo;
1413  ffc << "cover_" << rank << ".h5m";
1414  fft << "target_" << rank << ".h5m";
1415  ffo << "intx_" << rank << ".h5m";
1416  rval = m_interface->write_mesh( ffc.str().c_str(), &m_covering_source_set, 1 );MB_CHK_ERR( rval );
1417  rval = m_interface->write_mesh( fft.str().c_str(), &m_target_set, 1 );MB_CHK_ERR( rval );
1418  rval = m_interface->write_mesh( ffo.str().c_str(), &m_overlap_set, 1 );MB_CHK_ERR( rval );
1419 #endif
1420  // because we do not want to work with elements in coverage set that do not participate
1421  // in intersection, remove them from the coverage set we will not delete them yet, just
1422  // remove from the set !
1423  if( !point_cloud_target )
1424  {
1425  Range covEnts;
1427 
1428  std::map< int, int > loc_gid_to_lid_covsrc;
1429  std::vector< int > gids( covEnts.size(), -1 );
1430 
1431  Tag gidtag = m_interface->globalId_tag();
1432  rval = m_interface->tag_get_data( gidtag, covEnts, gids.data() );MB_CHK_ERR( rval );
1433 
1434  for( unsigned ie = 0; ie < gids.size(); ++ie )
1435  {
1436  assert( gids[ie] > 0 );
1437  loc_gid_to_lid_covsrc[gids[ie]] = ie;
1438  }
1439 
1440  Range intxCov, intxCells;
1441  Tag srcParentTag;
1442  rval = m_interface->tag_get_handle( "SourceParent", srcParentTag );MB_CHK_ERR( rval );
1443  rval = m_interface->get_entities_by_dimension( m_overlap_set, 2, intxCells );MB_CHK_ERR( rval );
1444  for( Range::iterator it = intxCells.begin(); it != intxCells.end(); it++ )
1445  {
1446  EntityHandle intxCell = *it;
1447  int srcParent = -1;
1448  rval = m_interface->tag_get_data( srcParentTag, &intxCell, 1, &srcParent );MB_CHK_ERR( rval );
1449 
1450  assert( srcParent >= 0 );
1451  intxCov.insert( covEnts[loc_gid_to_lid_covsrc[srcParent]] );
1452  }
1453 
1454  Range notNeededCovCells = moab::subtract( covEnts, intxCov );
1455 
1456  // now let us get only the covering entities that participate in intersection mesh
1457  covEnts = moab::subtract( covEnts, notNeededCovCells );
1458 
1459  // in order for getting 1-ring neighborhood, we need to be sure that the adjacencies are updated (created)
1460  if( false )
1461  {
1462  // update all adjacency list
1463  Core* mb = dynamic_cast< Core* >( m_interface );
1464  AEntityFactory* adj_fact = mb->a_entity_factory();
1465  if( !adj_fact->vert_elem_adjacencies() )
1466  adj_fact->create_vert_elem_adjacencies();
1467  else
1468  {
1469  for( Range::iterator it = covEnts.begin(); it != covEnts.end(); ++it )
1470  {
1471  EntityHandle eh = *it;
1472  const EntityHandle* conn = nullptr;
1473  int num_nodes = 0;
1474  rval = mb->get_connectivity( eh, conn, num_nodes );MB_CHK_ERR( rval );
1475  adj_fact->notify_create_entity( eh, conn, num_nodes );
1476  }
1477  }
1478 
1479  // next, for elements on the edge of the partition, get one ring adjacencies
1480  Skinner skinner( mb );
1481  Range skin;
1482  rval = skinner.find_skin( m_covering_source_set, covEnts, false, skin );MB_CHK_SET_ERR( rval, "Unable to find skin" );
1483  for( Range::iterator it = skin.begin(); it != skin.end(); ++it )
1484  {
1485  const EntityHandle* conn = nullptr;
1486  int len = 0;
1487  rval = mb->get_connectivity( *it, conn, len, false );MB_CHK_ERR( rval );
1488  for( int ie = 0; ie < len; ++ie )
1489  {
1490  std::vector< EntityHandle > adjacent_entities;
1491  rval = adj_fact->get_adjacencies( conn[ie], 2, false, adjacent_entities );MB_CHK_ERR( rval );
1492  for( auto ent : adjacent_entities )
1493  notNeededCovCells.erase( ent ); // ent is part of the 1-ring neighborhood
1494  }
1495  }
1496 
1497  rval = m_interface->write_mesh(
1498  std::string( "sourcecoveragemesh_p" + std::to_string( rank ) + ".h5m" ).c_str(),
1499  &m_covering_source_set, 1 );MB_CHK_ERR( rval );
1500  }
1501 
1502  // remove now from coverage set the cells that are not needed
1503  // rval = m_interface->remove_entities( m_covering_source_set, notNeededCovCells );MB_CHK_ERR( rval );
1504 
1505  // Need to loop over covEnts now and ensure at least N-rings are available dependign on whether bilinear (1) or
1506  // high order FV (p) methods are being used for map generation. For bilinear/FV(1): need 1 ring, and for FV(p)
1507  // need p=ring neighborhood to recover exact conservation and consistency wrt serial/parallel.
1508 #ifdef VERBOSE
1509  std::cout << " total participating elements in the covering set: " << intxCov.size() << "\n";
1510  std::cout << " remove from coverage set elements that are not intersected: " << notNeededCovCells.size()
1511  << "\n";
1512 #endif
1513  if( size > 1 )
1514  {
1515  // some source elements cover multiple target partitions; the conservation logic
1516  // requires to know all overlap elements for a source element; they need to be
1517  // communicated from the other target partitions
1518  //
1519  // so first we have to identify source (coverage) elements that cover multiple
1520  // target partitions
1521  //
1522  // we will then mark the source, we will need to migrate the overlap elements
1523  // that cover this to the original source for the source element; then
1524  // distribute the overlap elements to all processors that have the coverage mesh
1525  // used
1527  }
1528  }
1529  }
1530 #endif
1531 
1532  // Fix any inconsistencies in the overlap mesh
1533  {
1534  IntxAreaUtils areaAdaptor;
1536  MB_CHK_ERR( areaAdaptor.positive_orientation( m_interface, m_overlap_set, 1.0 /*radius*/ ) );
1537  }
1538 
1539  // free the memory
1540  delete mbintx;
1541  }
1542 
1543  // Now, let us convert the overlap mesh to MOAB format so that we have a consistent interface
1544  MB_CHK_SET_ERR( ConvertOverlapMeshSourceOrdered(), "Can't convert overlap TempestRemap mesh to MOAB format" );
1545 
1546  return MB_SUCCESS;
1547 }

References AugmentOverlapSet(), moab::Range::begin(), ConvertOverlapMeshSourceOrdered(), moab::AEntityFactory::create_vert_elem_adjacencies(), dbgprint, moab::Range::end(), moab::Range::erase(), ErrorCode, moab::Skinner::find_skin(), moab::IntxUtils::fix_degenerate_quads(), moab::AEntityFactory::get_adjacencies(), moab::Interface::get_entities_by_dimension(), moab::Interface::globalId_tag(), moab::Range::insert(), moab::Intx2Mesh::intersect_meshes(), moab::Intx2Mesh::intersect_meshes_kdtree(), is_parallel, m_covering_source, m_covering_source_set, moab::Remapper::m_interface, m_overlap, m_overlap_set, m_target, m_target_set, mb, MB_CHK_ERR, MB_CHK_SET_ERR, MB_SUCCESS, mbintx, moab::AEntityFactory::notify_create_entity(), point_cloud_target, moab::IntxAreaUtils::positive_orientation(), rank, rrmgrids, moab::DebugOutput::set_prefix(), moab::Range::size(), size, moab::subtract(), moab::Interface::tag_get_data(), moab::Interface::tag_get_handle(), moab::AEntityFactory::vert_elem_adjacencies(), and moab::Interface::write_mesh().

Referenced by main().

◆ ConstructCoveringSet()

ErrorCode moab::TempestRemapper::ConstructCoveringSet ( double  tolerance = 1e-8,
double  radius_src = 1.0,
double  radius_tgt = 1.0,
double  boxeps = 0.1,
bool  regional_mesh = false,
bool  gnomonic = true,
int  nb_ghost_layers = 0 
)

Construct a source covering mesh such that it completely encompasses the target grid in parallel. This operation is critical to ensure that the parallel advancing-front intersection algorithm can compute the intersection mesh only locally without any process communication.

Parameters
toleranceTolerance for the covering mesh construction (default: 1e-8)
radius_srcRadius of the source mesh (default: 1.0)
radius_tgtRadius of the target mesh (default: 1.0)
boxepsBox epsilon value (default: 0.1)
regional_meshFlag to indicate if the mesh is regional (default: false)
gnomonicFlag to indicate if the mesh is gnomonic (default: true)
nb_ghost_layersNumber of ghost layers (default: 0)
Returns
ErrorCode indicating the status of the covering mesh construction

Definition at line 1212 of file TempestRemapper.cpp.

1219 {
1220  ErrorCode rval;
1221 
1222  if (nb_ghost_layers >= 1)
1223  gnomonic = false;
1224  rrmgrids = regional_mesh;
1225  moab::Range local_verts;
1226 
1227  // Initialize intersection context
1229 
1231  mbintx->set_radius_source_mesh( radius_src );
1232  mbintx->set_radius_destination_mesh( radius_tgt );
1233  mbintx->set_box_error( boxeps );
1234 #ifdef MOAB_HAVE_MPI
1235  mbintx->set_parallel_comm( m_pcomm );
1236 #endif
1237 
1238  // compute the maxiumum edges in elements comprising source and target mesh
1240 
1243 
1244  // Note: lots of communication possible, if mesh is distributed very differently
1245 #ifdef MOAB_HAVE_MPI
1246  if( is_parallel )
1247  {
1248  rval = mbintx->build_processor_euler_boxes( m_target_set, local_verts, gnomonic );MB_CHK_ERR( rval );
1249 
1250  rval = m_interface->create_meshset( moab::MESHSET_SET, m_covering_source_set );MB_CHK_SET_ERR( rval, "Can't create new set" );
1251 
1252  rval = mbintx->construct_covering_set( m_source_set, m_covering_source_set, gnomonic, nb_ghost_layers );MB_CHK_ERR( rval );
1253 #ifdef MOAB_DBG
1254  std::stringstream filename;
1255  filename << "covering" << rank << ".h5m";
1256  rval = m_interface->write_file( filename.str().c_str(), 0, 0, &m_covering_source_set, 1 );MB_CHK_ERR( rval );
1257  std::stringstream targetFile;
1258  targetFile << "target" << rank << ".h5m";
1259  rval = m_interface->write_file( targetFile.str().c_str(), 0, 0, &m_target_set, 1 );MB_CHK_ERR( rval );
1260 #endif
1261  }
1262  else
1263  {
1264 #endif
1265  if( rrmgrids )
1266  {
1267  rval = m_interface->create_meshset( moab::MESHSET_SET, m_covering_source_set );MB_CHK_SET_ERR( rval, "Can't create new set" );
1268 
1269  double tolerance = 1e-6, btolerance = 1e-3;
1271  moab::Range targetVerts;
1272 
1273  rval = m_interface->get_connectivity( m_target_entities, targetVerts, true );MB_CHK_ERR( rval );
1274 
1275  rval = tree.build_tree( m_source_entities, &m_source_set );MB_CHK_ERR( rval );
1276 
1277  for( unsigned ie = 0; ie < targetVerts.size(); ++ie )
1278  {
1279  EntityHandle el = targetVerts[ie], leaf;
1280  double point[3];
1281 
1282  // Get the element centroid to be queried
1283  rval = m_interface->get_coords( &el, 1, point );MB_CHK_ERR( rval );
1284 
1285  // Search for the closest source element in the master mesh corresponding
1286  // to the target element centroid in the slave mesh
1287  rval = tree.point_search( point, leaf, tolerance, btolerance );MB_CHK_ERR( rval );
1288 
1289  if( leaf == 0 )
1290  {
1291  leaf = m_source_set; // no hint
1292  }
1293 
1294  std::vector< moab::EntityHandle > leaf_elems;
1295  // We only care about the dimension that the user specified.
1296  // MOAB partitions are ordered by elements anyway.
1297  rval = m_interface->get_entities_by_dimension( leaf, 2, leaf_elems );MB_CHK_ERR( rval );
1298 
1299  if( !leaf_elems.size() )
1300  {
1301  // std::cout << ie << ": " << " No leaf elements found." << std::endl;
1302  continue;
1303  }
1304 
1305  // Now get the master element centroids so that we can compute
1306  // the minimum distance to the target point
1307  std::vector< double > centroids( leaf_elems.size() * 3 );
1308  rval = m_interface->get_coords( &leaf_elems[0], leaf_elems.size(), &centroids[0] );MB_CHK_ERR( rval );
1309 
1310  double dist = 1e5;
1311  int pinelem = -1;
1312  for( size_t il = 0; il < leaf_elems.size(); ++il )
1313  {
1314  const double* centroid = &centroids[il * 3];
1315  const double locdist = std::pow( point[0] - centroid[0], 2 ) +
1316  std::pow( point[1] - centroid[1], 2 ) +
1317  std::pow( point[2] - centroid[2], 2 );
1318 
1319  if( locdist < dist )
1320  {
1321  dist = locdist;
1322  pinelem = il;
1323  m_covering_source_entities.insert( leaf_elems[il] );
1324  }
1325  }
1326 
1327  if( pinelem < 0 )
1328  {
1329  std::cout << ie
1330  << ": [Error] - Could not find a minimum distance within the leaf "
1331  "nodes. Dist = "
1332  << dist << std::endl;
1333  }
1334  }
1335  // rval = tree.reset_tree();MB_CHK_ERR(rval);
1336  std::cout << "[INFO] - Total covering source entities = " << m_covering_source_entities.size() << std::endl;
1338  }
1339  else
1340  {
1343  m_covering_source_entities = m_source_entities; // this is a tempest mesh object; careful about
1344  // incrementing the reference?
1345  m_covering_source_vertices = m_source_vertices; // this is a tempest mesh object; careful about
1346  // incrementing the reference?
1347  }
1348 #ifdef MOAB_HAVE_MPI
1349  }
1350 #endif
1351 
1352  // Convert the source, target and coverage meshes to TempestRemap format
1354 
1355  return rval;
1356 }

References moab::Interface::add_entities(), moab::AdaptiveKDTree::build_tree(), ConvertAllMeshesToTempest(), moab::Interface::create_meshset(), ErrorCode, moab::Intx2Mesh::FindMaxEdges(), moab::IntxAreaUtils::GaussQuadrature, moab::Interface::get_connectivity(), moab::Interface::get_coords(), moab::Interface::get_entities_by_dimension(), moab::Range::insert(), is_parallel, m_covering_source, m_covering_source_entities, m_covering_source_set, m_covering_source_vertices, moab::Remapper::m_interface, m_source, m_source_entities, m_source_set, m_source_vertices, m_target_entities, m_target_set, moab::Intx2Mesh::max_edges_1, moab::Intx2Mesh::max_edges_2, max_source_edges, max_target_edges, MB_CHK_ERR, MB_CHK_SET_ERR, mbintx, MESHSET_SET, moab::AdaptiveKDTree::point_search(), rank, rrmgrids, moab::Intx2Mesh::set_box_error(), moab::Intx2Mesh::set_error_tolerance(), moab::Intx2MeshOnSphere::set_radius_destination_mesh(), moab::Intx2MeshOnSphere::set_radius_source_mesh(), moab::Range::size(), moab::tolerance, and moab::Interface::write_file().

Referenced by main().

◆ convert_mesh_to_tempest_private()

ErrorCode moab::TempestRemapper::convert_mesh_to_tempest_private ( Mesh *  mesh,
moab::EntityHandle  meshset,
moab::Range entities,
moab::Range pverts 
)
private

Convert a MOAB mesh to TempestRemap format.

Parameters
meshTarget TempestRemap mesh pointer
meshsetMOAB mesh set to convert
entitiesRange of entities to convert
pvertsOptional pointer to vertex range
Returns
moab::ErrorCode Status of the conversion

Definition at line 623 of file TempestRemapper.cpp.

627 {
628  ErrorCode rval;
629  Range verts;
630 
631  NodeVector& nodes = mesh->nodes;
632  FaceVector& faces = mesh->faces;
633 
634  elems.clear();
635  rval = m_interface->get_entities_by_dimension( mesh_set, 2, elems );MB_CHK_ERR( rval );
636 
637  const size_t nelems = elems.size();
638 
639  // resize the number of elements in Tempest mesh
640  faces.resize( nelems );
641 
642  // let us now get the vertices from all the elements
643  rval = m_interface->get_connectivity( elems, verts );MB_CHK_ERR( rval );
644  if( verts.size() == 0 )
645  {
646  rval = m_interface->get_entities_by_dimension( mesh_set, 0, verts );MB_CHK_ERR( rval );
647  }
648  // assert(verts.size() > 0); // If not, this may be an invalid mesh ! possible for unbalanced loads
649 
650  std::map< EntityHandle, int > indxMap;
651  bool useRange = true;
652  if( verts.compactness() > 0.01 )
653  {
654  int j = 0;
655  for( Range::iterator it = verts.begin(); it != verts.end(); it++ )
656  indxMap[*it] = j++;
657  useRange = false;
658  }
659 
660  std::vector< int > globIds( nelems );
662  rval = m_interface->tag_get_data( gid, elems, &globIds[0] );MB_CHK_ERR( rval );
663  std::vector< size_t > sortedIdx;
664  if( offlineWorkflow )
665  {
666  sortedIdx.resize( nelems );
667  // initialize original index locations
668  std::iota( sortedIdx.begin(), sortedIdx.end(), 0 );
669  // sort indexes based on comparing values in v, using std::stable_sort instead of std::sort
670  // to avoid unnecessary index re-orderings when v contains elements of equal values
671  std::sort( sortedIdx.begin(), sortedIdx.end(),
672  [&globIds]( size_t i1, size_t i2 ) { return globIds[i1] < globIds[i2]; } );
673  }
674 
675  for( unsigned iface = 0; iface < nelems; ++iface )
676  {
677  Face& face = faces[iface];
678  EntityHandle ehandle = ( offlineWorkflow ? elems[sortedIdx[iface]] : elems[iface] );
679 
680  // get the connectivity for each edge
681  const EntityHandle* connectface;
682  int nnodesf;
683  rval = m_interface->get_connectivity( ehandle, connectface, nnodesf );MB_CHK_ERR( rval );
684  // account for padded polygons
685  while( connectface[nnodesf - 2] == connectface[nnodesf - 1] && nnodesf > 3 )
686  nnodesf--;
687 
688  face.edges.resize( nnodesf );
689  for( int iverts = 0; iverts < nnodesf; ++iverts )
690  {
691  int indx = ( useRange ? verts.index( connectface[iverts] ) : indxMap[connectface[iverts]] );
692  assert( indx >= 0 );
693  face.SetNode( iverts, indx );
694  }
695  }
696 
697  unsigned nnodes = verts.size();
698  nodes.resize( nnodes );
699 
700  // Set the data for the vertices
701  std::vector< double > coordx( nnodes ), coordy( nnodes ), coordz( nnodes );
702  rval = m_interface->get_coords( verts, &coordx[0], &coordy[0], &coordz[0] );MB_CHK_ERR( rval );
703  for( unsigned inode = 0; inode < nnodes; ++inode )
704  {
705  Node& node = nodes[inode];
706  node.x = coordx[inode];
707  node.y = coordy[inode];
708  node.z = coordz[inode];
709  }
710  coordx.clear();
711  coordy.clear();
712  coordz.clear();
713 
714  mesh->RemoveCoincidentNodes();
715  mesh->RemoveZeroEdges();
716 
717  // Generate reverse node array and edge map
718  if( constructEdgeMap ) mesh->ConstructEdgeMap( false );
719  // mesh->ConstructReverseNodeArray();
720 
721  // mesh->Validate();
722 
723  if( pverts )
724  {
725  pverts->clear();
726  *pverts = verts;
727  }
728  verts.clear();
729 
730  return MB_SUCCESS;
731 }

References moab::Range::begin(), moab::Range::clear(), moab::Range::compactness(), constructEdgeMap, moab::Range::end(), ErrorCode, moab::Interface::get_connectivity(), moab::Interface::get_coords(), moab::Interface::get_entities_by_dimension(), moab::Interface::globalId_tag(), iface, moab::Range::index(), moab::Remapper::m_interface, MB_CHK_ERR, MB_SUCCESS, offlineWorkflow, moab::Range::size(), and moab::Interface::tag_get_data().

Referenced by ConvertMeshToTempest(), and ResetMeshSet().

◆ convert_tempest_mesh_private()

ErrorCode moab::TempestRemapper::convert_tempest_mesh_private ( TempestMeshType  type,
Mesh *  mesh,
moab::EntityHandle meshset,
moab::Range entities,
moab::Range vertices 
)
private

Convert a TempestRemap mesh to MOAB format.

Parameters
typeType of the TempestRemap mesh
meshSource TempestRemap mesh
meshsetTarget MOAB mesh set
entitiesRange to store converted entities
verticesOptional range to store vertices
Returns
moab::ErrorCode Status of the conversion

Definition at line 255 of file TempestRemapper.cpp.

260 {
261  ErrorCode rval;
262  const bool outputEnabled = ( TempestRemapper::verbose && is_root );
263  const NodeVector& nodes = mesh->nodes;
264  const FaceVector& faces = mesh->faces;
265 
266  moab::DebugOutput dbgprint( std::cout, this->rank, 0 );
267  dbgprint.set_prefix( "[TempestToMOAB]: " );
268 
269  ReadUtilIface* iface;
270  rval = m_interface->query_interface( iface );MB_CHK_SET_ERR( rval, "Can't get reader interface" );
271 
272  Tag gidTag = m_interface->globalId_tag();
273 
274  // Set the data for the vertices
275  std::vector< double* > arrays;
276  std::vector< int > gidsv( nodes.size() );
277  EntityHandle startv;
278  rval = iface->get_node_coords( 3, nodes.size(), 0, startv, arrays );MB_CHK_SET_ERR( rval, "Can't get node coords" );
279  for( unsigned iverts = 0; iverts < nodes.size(); ++iverts )
280  {
281  const Node& node = nodes[iverts];
282  arrays[0][iverts] = node.x;
283  arrays[1][iverts] = node.y;
284  arrays[2][iverts] = node.z;
285  gidsv[iverts] = iverts + 1;
286  }
287  Range mbverts( startv, startv + nodes.size() - 1 );
288  rval = m_interface->add_entities( mesh_set, mbverts );MB_CHK_SET_ERR( rval, "Can't add entities" );
289  rval = m_interface->tag_set_data( gidTag, mbverts, &gidsv[0] );MB_CHK_SET_ERR( rval, "Can't set global_id tag" );
290 
291  gidsv.clear();
292  entities.clear();
293 
294  Tag srcParentTag, tgtParentTag;
295  std::vector< int > srcParent( faces.size(), -1 ), tgtParent( faces.size(), -1 );
296  std::vector< int > gidse( faces.size(), -1 );
297  bool storeParentInfo = ( mesh->vecSourceFaceIx.size() > 0 );
298 
299  if( storeParentInfo )
300  {
301  int defaultInt = -1;
302  rval = m_interface->tag_get_handle( "TargetParent", 1, MB_TYPE_INTEGER, tgtParentTag,
303  MB_TAG_DENSE | MB_TAG_CREAT, &defaultInt );MB_CHK_SET_ERR( rval, "can't create positive tag" );
304 
305  rval = m_interface->tag_get_handle( "SourceParent", 1, MB_TYPE_INTEGER, srcParentTag,
306  MB_TAG_DENSE | MB_TAG_CREAT, &defaultInt );MB_CHK_SET_ERR( rval, "can't create negative tag" );
307  }
308 
309  // Let us first perform a full pass assuming arbitrary polygons. This is especially true for
310  // overlap meshes.
311  // 1. We do a first pass over faces, decipher edge size and group into categories based on
312  // element type
313  // 2. Next we loop over type, and add blocks of elements into MOAB
314  // 3. For each block within the loop, also update the connectivity of elements.
315  {
316  if( outputEnabled )
317  dbgprint.printf( 0, "..Mesh size: Nodes [%zu] Elements [%zu].\n", nodes.size(), faces.size() );
318  std::vector< EntityHandle > mbcells( faces.size() );
319  unsigned ntris = 0, nquads = 0, npolys = 0;
320  std::vector< EntityHandle > conn( 16 );
321 
322  for( unsigned ifaces = 0; ifaces < faces.size(); ++ifaces )
323  {
324  const Face& face = faces[ifaces];
325  const unsigned num_v_per_elem = face.edges.size();
326 
327  for( unsigned iedges = 0; iedges < num_v_per_elem; ++iedges )
328  {
329  conn[iedges] = startv + face.edges[iedges].node[0];
330  }
331 
332  switch( num_v_per_elem )
333  {
334  case 3:
335  // if( outputEnabled )
336  // dbgprint.printf( 0, "....Block %d: Triangular Elements [%u].\n", iBlock++, nPolys[iType] );
337  rval = m_interface->create_element( MBTRI, &conn[0], num_v_per_elem, mbcells[ifaces] );MB_CHK_SET_ERR( rval, "Can't get element connectivity" );
338  ntris++;
339  break;
340  case 4:
341  // if( outputEnabled )
342  // dbgprint.printf( 0, "....Block %d: Quadrilateral Elements [%u].\n", iBlock++, nPolys[iType] );
343  rval = m_interface->create_element( MBQUAD, &conn[0], num_v_per_elem, mbcells[ifaces] );MB_CHK_SET_ERR( rval, "Can't get element connectivity" );
344  nquads++;
345  break;
346  default:
347  // if( outputEnabled )
348  // dbgprint.printf( 0, "....Block %d: Polygonal [%u] Elements [%u].\n", iBlock++, iType,
349  // nPolys[iType] );
350  rval = m_interface->create_element( MBPOLYGON, &conn[0], num_v_per_elem, mbcells[ifaces] );MB_CHK_SET_ERR( rval, "Can't get element connectivity" );
351  npolys++;
352  break;
353  }
354 
355  gidse[ifaces] = ifaces + 1;
356 
357  if( storeParentInfo )
358  {
359  srcParent[ifaces] = mesh->vecSourceFaceIx[ifaces] + 1;
360  tgtParent[ifaces] = mesh->vecTargetFaceIx[ifaces] + 1;
361  }
362  }
363 
364  if( ntris ) dbgprint.printf( 0, "....Triangular Elements [%u].\n", ntris );
365  if( nquads ) dbgprint.printf( 0, "....Quadrangular Elements [%u].\n", nquads );
366  if( npolys ) dbgprint.printf( 0, "....Polygonal Elements [%u].\n", npolys );
367 
368  rval = m_interface->add_entities( mesh_set, &mbcells[0], mbcells.size() );MB_CHK_SET_ERR( rval, "Could not add entities" );
369 
370  rval = m_interface->tag_set_data( gidTag, &mbcells[0], mbcells.size(), &gidse[0] );MB_CHK_SET_ERR( rval, "Can't set global_id tag" );
371  if( storeParentInfo )
372  {
373  rval = m_interface->tag_set_data( srcParentTag, &mbcells[0], mbcells.size(), &srcParent[0] );MB_CHK_SET_ERR( rval, "Can't set tag data" );
374  rval = m_interface->tag_set_data( tgtParentTag, &mbcells[0], mbcells.size(), &tgtParent[0] );MB_CHK_SET_ERR( rval, "Can't set tag data" );
375  }
376 
377  // insert from mbcells to entities to preserve ordering
378  std::copy( mbcells.begin(), mbcells.end(), range_inserter( entities ) );
379  }
380 
381  if( vertices ) *vertices = mbverts;
382 
383  return MB_SUCCESS;
384 }

References moab::Interface::add_entities(), moab::Interface::create_element(), dbgprint, entities, ErrorCode, moab::Interface::globalId_tag(), iface, is_root, moab::Remapper::m_interface, MB_CHK_SET_ERR, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_INTEGER, MBPOLYGON, MBQUAD, MBTRI, moab::Interface::query_interface(), rank, moab::DebugOutput::set_prefix(), moab::Interface::tag_get_handle(), moab::Interface::tag_set_data(), and verbose.

Referenced by ConvertTempestMesh().

◆ ConvertAllMeshesToTempest()

ErrorCode moab::TempestRemapper::ConvertAllMeshesToTempest ( )
private

Convert all MOAB meshes to TempestRemap format.

Utility method primarily used in online workflows to convert all meshes to TempestRemap format.

Returns
ErrorCode Status of the conversion

Definition at line 545 of file TempestRemapper.cpp.

546 {
547  // now, let us ensure we have a valid source and target mesh objects
548  // if not, convert the source and target meshes to TempestRemap format
549  if( this->m_source == nullptr )
550  {
551  // Convert the covering mesh to TempestRemap format
553  "Can't convert source mesh to TempestRemap format" );
554  }
555  if( this->m_covering_source == nullptr )
556  {
557  // Convert the covering mesh to TempestRemap format
559  "Can't convert source coverage mesh to TempestRemap format" );
560  }
561  if( this->m_target == nullptr )
562  {
563  // Convert the covering mesh to TempestRemap format
565  "Can't convert target mesh to TempestRemap format" );
566  }
567 
568  return moab::MB_SUCCESS;
569 }

References ConvertMeshToTempest(), moab::Remapper::CoveringMesh, m_covering_source, m_source, m_target, MB_CHK_SET_ERR, MB_SUCCESS, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

Referenced by ConstructCoveringSet().

◆ ConvertMeshToTempest()

ErrorCode moab::TempestRemapper::ConvertMeshToTempest ( Remapper::IntersectionContext  ctx)

Convert the MOAB mesh representation to a corresponding TempestRemap mesh object according to the intersection context.

Parameters
ctxIntersection context
Returns
ErrorCode indicating the status of the mesh conversion

Definition at line 571 of file TempestRemapper.cpp.

572 {
573  const bool outputEnabled = ( TempestRemapper::verbose && is_root );
574 
575  // create a debug output object and set a prefix
576  moab::DebugOutput dbgprint( std::cout, this->rank, 0 );
577  dbgprint.set_prefix( "[MOABToTempest]: " );
578 
579  if( ctx == Remapper::SourceMesh )
580  {
581  if( !m_source ) m_source = new Mesh();
582  if( outputEnabled ) dbgprint.printf( 0, "Converting (source) MOAB to TempestRemap Mesh representation ...\n" );
585  "Can't convert source mesh to Tempest" );
586  if( m_source_entities.size() == 0 && m_source_vertices.size() != 0 )
587  {
588  this->point_cloud_source = true;
589  }
590  }
591  else if( ctx == Remapper::CoveringMesh )
592  {
593  if( !m_covering_source ) m_covering_source = new Mesh();
594  if( outputEnabled )
595  dbgprint.printf( 0, "Converting (covering source) MOAB to TempestRemap Mesh representation ...\n" );
598  "Can't convert convering source mesh to TempestRemap format" );
599  }
600  else if( ctx == Remapper::TargetMesh )
601  {
602  if( !m_target ) m_target = new Mesh();
603  if( outputEnabled ) dbgprint.printf( 0, "Converting (target) MOAB to TempestRemap Mesh representation ...\n" );
606  "Can't convert target mesh to Tempest" );
607  if( m_target_entities.size() == 0 && m_target_vertices.size() != 0 ) this->point_cloud_target = true;
608  }
609  else if( ctx == Remapper::OverlapMesh ) // Overlap mesh
610  {
611  if( !m_overlap ) m_overlap = new Mesh();
612  if( outputEnabled ) dbgprint.printf( 0, "Converting (overlap) MOAB to TempestRemap Mesh representation ...\n" );
613  MB_CHK_SET_ERR( ConvertOverlapMeshSourceOrdered(), "Can't convert overlap mesh to Tempest" );
614  }
615  else
616  {
617  MB_CHK_SET_ERR( MB_FAILURE, "Invalid IntersectionContext context provided" );
618  }
619 
620  return moab::MB_SUCCESS;
621 }

References convert_mesh_to_tempest_private(), ConvertOverlapMeshSourceOrdered(), moab::Remapper::CoveringMesh, dbgprint, is_root, m_covering_source, m_covering_source_entities, m_covering_source_set, m_covering_source_vertices, m_overlap, m_source, m_source_entities, m_source_set, m_source_vertices, m_target, m_target_entities, m_target_set, m_target_vertices, MB_CHK_SET_ERR, MB_SUCCESS, moab::Remapper::OverlapMesh, point_cloud_source, point_cloud_target, rank, moab::DebugOutput::set_prefix(), moab::Range::size(), moab::Remapper::SourceMesh, moab::Remapper::TargetMesh, and verbose.

Referenced by ConvertAllMeshesToTempest(), CreateTempestMesh(), and main().

◆ ConvertOverlapMeshSourceOrdered()

ErrorCode moab::TempestRemapper::ConvertOverlapMeshSourceOrdered ( )
private

Convert overlap mesh to source-ordered format.

Transforms the overlap mesh into a source-ordered format compatible with TempestRemap.

Returns
moab::ErrorCode Status of the conversion

Definition at line 783 of file TempestRemapper.cpp.

784 {
785  ErrorCode rval;
786 
789  size_t n_overlap_entitites = m_overlap_entities.size();
790 
791  // Allocate for the overlap mesh
792  if( !m_overlap ) m_overlap = new Mesh();
793 
794  std::vector< std::array< int, 3 > > sorted_overlap_order( n_overlap_entitites,
795  std::array< int, 3 >( { -1, -1, -1 } ) );
796  {
797  Tag srcParentTag, tgtParentTag;
798  rval = m_interface->tag_get_handle( "SourceParent", srcParentTag );MB_CHK_ERR( rval );
799  rval = m_interface->tag_get_handle( "TargetParent", tgtParentTag );MB_CHK_ERR( rval );
800  // Overlap mesh: resize the source and target connection arrays
801  m_overlap->vecTargetFaceIx.resize( n_overlap_entitites );
802  m_overlap->vecSourceFaceIx.resize( n_overlap_entitites );
803 
804  // We need a global to local numbering
805  Tag gidtag = m_interface->globalId_tag();
806  std::vector< int > gids_src( m_covering_source_entities.size(), -1 ), gids_tgt( m_target_entities.size(), -1 );
807  MB_CHK_ERR( m_interface->tag_get_data( gidtag, m_covering_source_entities, gids_src.data() ) );
808  MB_CHK_ERR( m_interface->tag_get_data( gidtag, m_target_entities, gids_tgt.data() ) );
809 
810 // #define USE_SORTED_GIDS
811 #ifdef USE_SORTED_GIDS
812  // let us sort the global indices so that we always have a consistent ordering
813  std::sort( gids_src.begin(), gids_src.end() );
814  std::sort( gids_tgt.begin(), gids_tgt.end() );
815 
816  auto find_lid = []( std::vector< int >& gids, int gid ) -> int {
817  // auto it = std::equal_range( gids.begin(), gids.end(), gid );
818  // return ( ( it.first != it.second ) ? std::distance( gids.begin(), it.first ) : -1 );
819 
820  auto it = std::lower_bound( gids.begin(), gids.end(), gid );
821  return ( it != gids.end() ? std::distance( gids.begin(), it ) : -1 );
822  };
823 #else
824  auto find_lid = []( std::vector< int >& gids, int gid ) -> int {
825  auto it = std::find( gids.begin(), gids.end(), gid );
826  return ( it != gids.end() ? std::distance( gids.begin(), it ) : -1 );
827  };
828 #endif
829 
830  std::vector< int > ghFlags;
831  if( is_parallel )
832  {
833  Tag ghostTag;
834  ghFlags.resize( n_overlap_entitites );
835  MB_CHK_SET_ERR( m_interface->tag_get_handle( "ORIG_PROC", ghostTag ), "Could not find ORIG_PROC tag" );
836  MB_CHK_ERR( m_interface->tag_get_data( ghostTag, m_overlap_entities, ghFlags.data() ) );
837  }
838 
839  // Overlap mesh: resize the source and target connection arrays
840  std::vector< int > rbids_src( n_overlap_entitites ), rbids_tgt( n_overlap_entitites );
841  MB_CHK_ERR( m_interface->tag_get_data( srcParentTag, m_overlap_entities, rbids_src.data() ) );
842  MB_CHK_ERR( m_interface->tag_get_data( tgtParentTag, m_overlap_entities, rbids_tgt.data() ) );
843 
844  for( size_t ix = 0; ix < n_overlap_entitites; ++ix )
845  {
846  std::get< 0 >( sorted_overlap_order[ix] ) = ix;
847  std::get< 1 >( sorted_overlap_order[ix] ) = find_lid( gids_src, rbids_src[ix] );
848  assert( std::get< 1 >( sorted_overlap_order[ix] ) >= 0 );
849  if( is_parallel && ghFlags[ix] >= 0 ) // it means it is a ghost overlap element
850  std::get< 2 >( sorted_overlap_order[ix] ) = -1; // this should not participate in the map!
851  else
852  std::get< 2 >( sorted_overlap_order[ix] ) = find_lid( gids_tgt, rbids_tgt[ix] );
853  }
854  // now sort the overlap elements such that they are ordered by source parent first
855  // and then target parent next
856  std::sort( sorted_overlap_order.begin(), sorted_overlap_order.end(), IntPairComparator );
857 
858  for( unsigned ie = 0; ie < n_overlap_entitites; ++ie )
859  {
860  // int ix = std::get< 0 >( sorted_overlap_order[ie] ); // original index of the element
861  m_overlap->vecSourceFaceIx[ie] = std::get< 1 >( sorted_overlap_order[ie] );
862  m_overlap->vecTargetFaceIx[ie] = std::get< 2 >( sorted_overlap_order[ie] );
863  }
864  }
865 
866  FaceVector& faces = m_overlap->faces;
867  faces.resize( n_overlap_entitites );
868 
869  Range verts;
870  // let us now get the vertices from all the elements
872 
873  std::map< EntityHandle, int > indxMap;
874  {
875  int j = 0;
876  for( Range::iterator it = verts.begin(); it != verts.end(); ++it )
877  indxMap[*it] = j++;
878  }
879 
880  for( unsigned ifac = 0; ifac < m_overlap_entities.size(); ++ifac )
881  {
882  const unsigned iface = std::get< 0 >( sorted_overlap_order[ifac] );
883  Face& face = faces[ifac];
885 
886  // get the connectivity for each edge
887  const EntityHandle* connectface;
888  int nnodesf;
889  MB_CHK_ERR( m_interface->get_connectivity( ehandle, connectface, nnodesf ) );
890 
891  face.edges.resize( nnodesf );
892  for( int iverts = 0; iverts < nnodesf; ++iverts )
893  {
894  int indx = indxMap[connectface[iverts]];
895  assert( indx >= 0 );
896  face.SetNode( iverts, indx );
897  }
898  }
899  indxMap.clear();
900  sorted_overlap_order.clear();
901 
902  unsigned nnodes = verts.size();
903  NodeVector& nodes = m_overlap->nodes;
904  nodes.resize( nnodes );
905 
906  // Set the data for the vertices
907  std::vector< double > coordx( nnodes ), coordy( nnodes ), coordz( nnodes );
908  rval = m_interface->get_coords( verts, &coordx[0], &coordy[0], &coordz[0] );MB_CHK_ERR( rval );
909  for( unsigned inode = 0; inode < nnodes; ++inode )
910  {
911  Node& node = nodes[inode];
912  node.x = coordx[inode];
913  node.y = coordy[inode];
914  node.z = coordz[inode];
915  }
916  coordx.clear();
917  coordy.clear();
918  coordz.clear();
919  verts.clear();
920 
921  // m_overlap->RemoveZeroEdges();
922  // m_overlap->RemoveCoincidentNodes( false );
923 
924  // Generate reverse node array and edge map
925  // if ( constructEdgeMap ) m_overlap->ConstructEdgeMap(false);
926  // m_overlap->ConstructReverseNodeArray();
927 
928  m_overlap->Validate();
929  return MB_SUCCESS;
930 }

References moab::Range::begin(), moab::Range::clear(), moab::Range::end(), ErrorCode, moab::Interface::get_connectivity(), moab::Interface::get_coords(), moab::Interface::get_entities_by_dimension(), moab::Interface::globalId_tag(), iface, moab::IntPairComparator(), is_parallel, m_covering_source_entities, moab::Remapper::m_interface, m_overlap, m_overlap_entities, m_overlap_set, m_target_entities, MB_CHK_ERR, MB_CHK_SET_ERR, MB_SUCCESS, moab::Range::size(), moab::Interface::tag_get_data(), and moab::Interface::tag_get_handle().

Referenced by ComputeOverlapMesh(), and ConvertMeshToTempest().

◆ ConvertTempestMesh()

ErrorCode moab::TempestRemapper::ConvertTempestMesh ( Remapper::IntersectionContext  ctx)

Convert the TempestRemap mesh object to a corresponding MOAB mesh representation according to the intersection context.

Parameters
ctxIntersection context
Returns
ErrorCode indicating the status of the mesh conversion

Definition at line 226 of file TempestRemapper.cpp.

227 {
228  const bool outputEnabled = ( TempestRemapper::verbose && is_root );
229  if( ctx == Remapper::SourceMesh )
230  {
231  if( outputEnabled ) std::cout << "Converting (source) TempestRemap Mesh object to MOAB representation ...\n";
234  }
235  else if( ctx == Remapper::TargetMesh )
236  {
237  if( outputEnabled ) std::cout << "Converting (target) TempestRemap Mesh object to MOAB representation ...\n";
240  }
241  else if( ctx != Remapper::DEFAULT )
242  {
243  if( outputEnabled ) std::cout << "Converting (overlap) TempestRemap Mesh object to MOAB representation ...\n";
245  }
246  else
247  {
248  MB_CHK_SET_ERR( MB_FAILURE, "Invalid IntersectionContext context provided" );
249  }
250 }

References convert_tempest_mesh_private(), moab::Remapper::DEFAULT, is_root, m_overlap, m_overlap_entities, m_overlap_set, m_overlap_type, m_source, m_source_entities, m_source_set, m_source_type, m_source_vertices, m_target, m_target_entities, m_target_set, m_target_type, m_target_vertices, MB_CHK_SET_ERR, moab::Remapper::SourceMesh, moab::Remapper::TargetMesh, and verbose.

Referenced by main().

◆ GenerateCSMeshMetadata()

ErrorCode moab::TempestRemapper::GenerateCSMeshMetadata ( const int  ntot_elements,
moab::Range entities,
moab::Range secondary_entities,
const std::string &  dofTagName,
int  nP 
)

Generate the necessary metadata and specifically the GLL node numbering for DoFs for a CS mesh. This negates the need for running external code like HOMME to output the numbering needed for computing maps. The functionality is used through the mbconvert tool to compute processor-invariant Global DoF IDs at GLL nodes.

Parameters
ntot_elementsTotal number of elements
entitiesMOAB range of entities
secondary_entitiesMOAB range of secondary entities (optional)
dofTagNameName of the DoF tag
nPNumber of points
Returns
ErrorCode indicating the status of the metadata generation

Definition at line 1032 of file TempestRemapper.cpp.

1037 {
1038  const int csResolution = std::sqrt( ntot_elements / 6.0 );
1039  if( csResolution * csResolution * 6 != ntot_elements ) return MB_INVALID_SIZE;
1040 
1041  // Create a temporary Cubed-Sphere mesh
1042  // NOTE: This will not work for RRM grids. Need to run HOMME for that case anyway
1043  Mesh csMesh;
1044  if( GenerateCSMesh( csMesh, csResolution, "", "NetCDF4" ) )
1045  MB_CHK_SET_ERR( moab::MB_FAILURE, // unsuccessful call
1046  "Failed to generate CS mesh through TempestRemap" );
1047 
1048  // let us now generate the mesh metadata
1049  if( this->GenerateMeshMetadata( csMesh, ntot_elements, ents, secondary_ents, dofTagName, nP ) )
1050  MB_CHK_SET_ERR( moab::MB_FAILURE, "Failed in call to GenerateMeshMetadata" ); // unsuccessful call
1051 
1052  return moab::MB_SUCCESS;
1053 }

References GenerateMeshMetadata(), MB_CHK_SET_ERR, MB_INVALID_SIZE, and MB_SUCCESS.

◆ GenerateMesh()

moab::ErrorCode moab::TempestRemapper::GenerateMesh ( Remapper::IntersectionContext  ctx,
TempestMeshType  type 
)

Generate a mesh in memory of given type (CS/RLL/ICO/MPAS(structured)) and store it under the context specified by the user.

Parameters
ctxIntersection context
typeType of mesh to generate
Returns
ErrorCode indicating the status of the mesh generation

◆ GenerateMeshMetadata()

ErrorCode moab::TempestRemapper::GenerateMeshMetadata ( Mesh &  mesh,
const int  ntot_elements,
moab::Range entities,
moab::Range secondary_entities,
const std::string  dofTagName,
int  nP 
)

Generate the necessary metadata for DoF node numbering in a given mesh. Currently, only the functionality to generate numbering on CS grids is supported.

Parameters
meshMesh object
ntot_elementsTotal number of elements
entitiesMOAB range of entities
secondary_entitiesMOAB range of secondary entities (optional)
dofTagNameName of the DoF tag
nPNumber of points
Returns
ErrorCode indicating the status of the metadata generation

Definition at line 1055 of file TempestRemapper.cpp.

1061 {
1062  moab::ErrorCode rval;
1063 
1064  Tag dofTag;
1065  bool created = false;
1066  rval = m_interface->tag_get_handle( dofTagName.c_str(), nP * nP, MB_TYPE_INTEGER, dofTag,
1067  MB_TAG_DENSE | MB_TAG_CREAT, 0, &created );MB_CHK_SET_ERR( rval, "Failed creating DoF tag" );
1068 
1069  // Number of Faces
1070  int nElements = static_cast< int >( csMesh.faces.size() );
1071 
1072  if( nElements != ntot_elements ) return MB_INVALID_SIZE;
1073 
1074  // Initialize data structures
1075  DataArray3D< int > dataGLLnodes;
1076  dataGLLnodes.Allocate( nP, nP, nElements );
1077 
1078  std::map< Node, int > mapNodes;
1079  std::map< Node, moab::EntityHandle > mapLocalMBNodes;
1080 
1081  // GLL Quadrature nodes
1082  DataArray1D< double > dG;
1083  DataArray1D< double > dW;
1084  GaussLobattoQuadrature::GetPoints( nP, 0.0, 1.0, dG, dW );
1085 
1086  moab::Range entities( ents );
1087  if( secondary_ents ) entities.insert( secondary_ents->begin(), secondary_ents->end() );
1088  double elcoords[3];
1089  for( unsigned iel = 0; iel < entities.size(); ++iel )
1090  {
1091  EntityHandle eh = entities[iel];
1092  rval = m_interface->get_coords( &eh, 1, elcoords );
1093  Node elCentroid( elcoords[0], elcoords[1], elcoords[2] );
1094  mapLocalMBNodes.insert( std::pair< Node, moab::EntityHandle >( elCentroid, eh ) );
1095  }
1096 
1097  // Build a Kd-tree for local mesh (nearest neighbor searches)
1098  // Loop over all elements in CS-Mesh
1099  // Then find if current centroid is in an element
1100  // If yes - then let us compute the DoF numbering and set to tag data
1101  // If no - then compute DoF numbering BUT DO NOT SET to tag data
1102  // continue
1103  int* dofIDs = new int[nP * nP];
1104 
1105  // Write metadata
1106  for( int k = 0; k < nElements; k++ )
1107  {
1108  const Face& face = csMesh.faces[k];
1109  const NodeVector& nodes = csMesh.nodes;
1110 
1111  if( face.edges.size() != 4 )
1112  {
1113  _EXCEPTIONT( "Mesh must only contain quadrilateral elements" );
1114  }
1115 
1116  Node centroid;
1117  centroid.x = centroid.y = centroid.z = 0.0;
1118  for( unsigned l = 0; l < face.edges.size(); ++l )
1119  {
1120  centroid.x += nodes[face[l]].x;
1121  centroid.y += nodes[face[l]].y;
1122  centroid.z += nodes[face[l]].z;
1123  }
1124  const double factor = 1.0 / face.edges.size();
1125  centroid.x *= factor;
1126  centroid.y *= factor;
1127  centroid.z *= factor;
1128 
1129  bool locElem = false;
1130  EntityHandle current_eh;
1131  if( mapLocalMBNodes.find( centroid ) != mapLocalMBNodes.end() )
1132  {
1133  locElem = true;
1134  current_eh = mapLocalMBNodes[centroid];
1135  }
1136 
1137  for( int j = 0; j < nP; j++ )
1138  {
1139  for( int i = 0; i < nP; i++ )
1140  {
1141  // Get local map vectors
1142  Node nodeGLL;
1143  Node dDx1G;
1144  Node dDx2G;
1145 
1146  // ApplyLocalMap(
1147  // face,
1148  // nodevec,
1149  // dG[i],
1150  // dG[j],
1151  // nodeGLL,
1152  // dDx1G,
1153  // dDx2G);
1154  const double& dAlpha = dG[i];
1155  const double& dBeta = dG[j];
1156 
1157  // Calculate nodal locations on the plane
1158  double dXc = nodes[face[0]].x * ( 1.0 - dAlpha ) * ( 1.0 - dBeta ) +
1159  nodes[face[1]].x * dAlpha * ( 1.0 - dBeta ) + nodes[face[2]].x * dAlpha * dBeta +
1160  nodes[face[3]].x * ( 1.0 - dAlpha ) * dBeta;
1161 
1162  double dYc = nodes[face[0]].y * ( 1.0 - dAlpha ) * ( 1.0 - dBeta ) +
1163  nodes[face[1]].y * dAlpha * ( 1.0 - dBeta ) + nodes[face[2]].y * dAlpha * dBeta +
1164  nodes[face[3]].y * ( 1.0 - dAlpha ) * dBeta;
1165 
1166  double dZc = nodes[face[0]].z * ( 1.0 - dAlpha ) * ( 1.0 - dBeta ) +
1167  nodes[face[1]].z * dAlpha * ( 1.0 - dBeta ) + nodes[face[2]].z * dAlpha * dBeta +
1168  nodes[face[3]].z * ( 1.0 - dAlpha ) * dBeta;
1169 
1170  double dR = sqrt( dXc * dXc + dYc * dYc + dZc * dZc );
1171 
1172  // Mapped node location
1173  nodeGLL.x = dXc / dR;
1174  nodeGLL.y = dYc / dR;
1175  nodeGLL.z = dZc / dR;
1176 
1177  // Determine if this is a unique Node
1178  std::map< Node, int >::const_iterator iter = mapNodes.find( nodeGLL );
1179  if( iter == mapNodes.end() )
1180  {
1181  // Insert new unique node into map
1182  int ixNode = static_cast< int >( mapNodes.size() );
1183  mapNodes.insert( std::pair< Node, int >( nodeGLL, ixNode ) );
1184  dataGLLnodes[j][i][k] = ixNode + 1;
1185  }
1186  else
1187  {
1188  dataGLLnodes[j][i][k] = iter->second + 1;
1189  }
1190 
1191  dofIDs[j * nP + i] = dataGLLnodes[j][i][k];
1192  }
1193  }
1194 
1195  if( locElem )
1196  {
1197  rval = m_interface->tag_set_data( dofTag, &current_eh, 1, dofIDs );MB_CHK_SET_ERR( rval, "Failed to tag_set_data for DoFs" );
1198  }
1199  }
1200 
1201  // clear memory
1202  delete[] dofIDs;
1203  mapLocalMBNodes.clear();
1204  mapNodes.clear();
1205 
1206  return moab::MB_SUCCESS;
1207 }

References moab::Range::begin(), moab::Range::end(), entities, ErrorCode, moab::Interface::get_coords(), moab::Remapper::m_interface, MB_CHK_SET_ERR, MB_INVALID_SIZE, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_INTEGER, moab::Interface::tag_get_handle(), and moab::Interface::tag_set_data().

Referenced by GenerateCSMeshMetadata(), and main().

◆ GetCoveringMesh()

Mesh * moab::TempestRemapper::GetCoveringMesh ( )
inline

Get the covering mesh (TempestRemap) object.

Returns
Pointer to the covering mesh object

Definition at line 746 of file TempestRemapper.hpp.

747 {
748  return m_covering_source;
749 }

References m_covering_source.

Referenced by moab::TempestOnlineMap::TempestOnlineMap().

◆ GetCoveringSet()

moab::EntityHandle & moab::TempestRemapper::GetCoveringSet ( )
inline

Get access to the underlying source covering set if available. Else return the source set.

Returns
MOAB entity handle of the covering set

Definition at line 751 of file TempestRemapper.hpp.

752 {
753  return m_covering_source_set;
754 }

References m_covering_source_set.

◆ GetIMasks()

ErrorCode moab::TempestRemapper::GetIMasks ( Remapper::IntersectionContext  ctx,
std::vector< int > &  masks 
)

Get the masks that could have been defined.

Parameters
ctxIntersection context
masksVector of masks
Returns
ErrorCode indicating the status of the get operation

Definition at line 2167 of file TempestRemapper.cpp.

2168 {
2169  Tag maskTag;
2170  // it should have been created already, if not, we might have a problem
2171  int def_val = 1;
2172  ErrorCode rval =
2173  m_interface->tag_get_handle( "GRID_IMASK", 1, MB_TYPE_INTEGER, maskTag, MB_TAG_DENSE | MB_TAG_CREAT, &def_val );MB_CHK_SET_ERR( rval, "Trouble creating GRID_IMASK tag" );
2174 
2175  switch( ctx )
2176  {
2177  case Remapper::SourceMesh: {
2178  if( point_cloud_source )
2179  {
2180  masks.resize( m_source_vertices.size() );
2181  rval = m_interface->tag_get_data( maskTag, m_source_vertices, &masks[0] );MB_CHK_SET_ERR( rval, "Trouble getting GRID_IMASK tag" );
2182  }
2183  else
2184  {
2185  masks.resize( m_source_entities.size() );
2186  rval = m_interface->tag_get_data( maskTag, m_source_entities, &masks[0] );MB_CHK_SET_ERR( rval, "Trouble getting GRID_IMASK tag" );
2187  }
2188  return MB_SUCCESS;
2189  }
2190  case Remapper::TargetMesh: {
2191  if( point_cloud_target )
2192  {
2193  masks.resize( m_target_vertices.size() );
2194  rval = m_interface->tag_get_data( maskTag, m_target_vertices, &masks[0] );MB_CHK_SET_ERR( rval, "Trouble getting GRID_IMASK tag" );
2195  }
2196  else
2197  {
2198  masks.resize( m_target_entities.size() );
2199  rval = m_interface->tag_get_data( maskTag, m_target_entities, &masks[0] );MB_CHK_SET_ERR( rval, "Trouble getting GRID_IMASK tag" );
2200  }
2201  return MB_SUCCESS;
2202  }
2204  case Remapper::OverlapMesh:
2205  default:
2206  return MB_SUCCESS;
2207  }
2208 }

References moab::Remapper::CoveringMesh, ErrorCode, moab::Remapper::m_interface, m_source_entities, m_source_vertices, m_target_entities, m_target_vertices, MB_CHK_SET_ERR, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_INTEGER, moab::Remapper::OverlapMesh, point_cloud_source, point_cloud_target, moab::Range::size(), moab::Remapper::SourceMesh, moab::Interface::tag_get_data(), moab::Interface::tag_get_handle(), and moab::Remapper::TargetMesh.

◆ GetMesh()

Mesh * moab::TempestRemapper::GetMesh ( Remapper::IntersectionContext  ctx)
inline

Get the TempestRemap mesh object according to the intersection context.

Parameters
ctxIntersection context
Returns
Pointer to the TempestRemap mesh object

Definition at line 513 of file TempestRemapper.hpp.

514 {
515  switch( ctx )
516  {
518  return m_source;
520  return m_target;
522  return m_overlap;
524  return m_covering_source;
525  case Remapper::DEFAULT:
526  default:
527  return NULL;
528  }
529 }

References moab::Remapper::CoveringMesh, moab::Remapper::DEFAULT, m_covering_source, m_overlap, m_source, m_target, moab::Remapper::OverlapMesh, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

Referenced by CreateTempestMesh(), main(), and moab::TempestOnlineMap::TempestOnlineMap().

◆ GetMeshEntities() [1/2]

moab::Range & moab::TempestRemapper::GetMeshEntities ( Remapper::IntersectionContext  ctx)
inline

Get the mesh element entities corresponding to the intersection context.

Parameters
ctxIntersection context
Returns
MOAB range of mesh element entities

Definition at line 623 of file TempestRemapper.hpp.

624 {
625  switch( ctx )
626  {
628  return m_source_entities;
630  return m_target_entities;
632  return m_overlap_entities;
635  case Remapper::DEFAULT:
636  default:
637  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_overlap_entities );
638  }
639 }

References moab::Remapper::CoveringMesh, moab::Remapper::DEFAULT, m_covering_source_entities, m_overlap_entities, m_source_entities, m_target_entities, MB_SET_ERR_RET_VAL, moab::Remapper::OverlapMesh, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

Referenced by main().

◆ GetMeshEntities() [2/2]

const moab::Range & moab::TempestRemapper::GetMeshEntities ( Remapper::IntersectionContext  ctx) const
inline

Const overload. Get the mesh element entities corresponding to the intersection context.

Parameters
ctxIntersection context
Returns
MOAB range of mesh element entities

Definition at line 641 of file TempestRemapper.hpp.

642 {
643  switch( ctx )
644  {
646  return m_source_entities;
648  return m_target_entities;
650  return m_overlap_entities;
653  case Remapper::DEFAULT:
654  default:
655  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_overlap_entities );
656  }
657 }

References moab::Remapper::CoveringMesh, moab::Remapper::DEFAULT, m_covering_source_entities, m_overlap_entities, m_source_entities, m_target_entities, MB_SET_ERR_RET_VAL, moab::Remapper::OverlapMesh, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

◆ GetMeshSet() [1/2]

moab::EntityHandle & moab::TempestRemapper::GetMeshSet ( Remapper::IntersectionContext  ctx)
inline

Get the MOAB mesh set corresponding to the intersection context.

Parameters
ctxIntersection context
Returns
MOAB mesh set handle

Definition at line 587 of file TempestRemapper.hpp.

588 {
589  switch( ctx )
590  {
592  return m_source_set;
594  return m_target_set;
596  return m_overlap_set;
598  return m_covering_source_set;
599  case Remapper::DEFAULT:
600  default:
601  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_overlap_set );
602  }
603 }

References moab::Remapper::CoveringMesh, moab::Remapper::DEFAULT, m_covering_source_set, m_overlap_set, m_source_set, m_target_set, MB_SET_ERR_RET_VAL, moab::Remapper::OverlapMesh, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

Referenced by CreateTempestMesh(), and main().

◆ GetMeshSet() [2/2]

moab::EntityHandle moab::TempestRemapper::GetMeshSet ( Remapper::IntersectionContext  ctx) const
inline

Const overload. Get the MOAB mesh set corresponding to the intersection context.

Parameters
ctxIntersection context
Returns
MOAB mesh set handle

Definition at line 605 of file TempestRemapper.hpp.

606 {
607  switch( ctx )
608  {
610  return m_source_set;
612  return m_target_set;
614  return m_overlap_set;
616  return m_covering_source_set;
617  case Remapper::DEFAULT:
618  default:
619  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_overlap_set );
620  }
621 }

References moab::Remapper::CoveringMesh, moab::Remapper::DEFAULT, m_covering_source_set, m_overlap_set, m_source_set, m_target_set, MB_SET_ERR_RET_VAL, moab::Remapper::OverlapMesh, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

◆ GetMeshType()

TempestRemapper::TempestMeshType moab::TempestRemapper::GetMeshType ( Remapper::IntersectionContext  ctx) const
inline

Get the mesh type corresponding to the intersection context.

Parameters
ctxIntersection context
Returns
Mesh type

Definition at line 730 of file TempestRemapper.hpp.

731 {
732  switch( ctx )
733  {
735  return m_source_type;
737  return m_target_type;
739  return m_overlap_type;
740  case Remapper::DEFAULT:
741  default:
743  }
744 }

References moab::Remapper::DEFAULT, DEFAULT, m_overlap_type, m_source_type, m_target_type, moab::Remapper::OverlapMesh, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

◆ GetMeshVertices() [1/2]

moab::Range & moab::TempestRemapper::GetMeshVertices ( Remapper::IntersectionContext  ctx)
inline

Get the mesh vertices corresponding to the intersection context. Useful for point-cloud meshes.

Parameters
ctxIntersection context
Returns
MOAB range of mesh vertices

Definition at line 659 of file TempestRemapper.hpp.

660 {
661  switch( ctx )
662  {
664  return m_source_vertices;
666  return m_target_vertices;
669  case Remapper::DEFAULT:
670  default:
671  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_source_vertices );
672  }
673 }

References moab::Remapper::CoveringMesh, moab::Remapper::DEFAULT, m_covering_source_vertices, m_source_vertices, m_target_vertices, MB_SET_ERR_RET_VAL, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

Referenced by main().

◆ GetMeshVertices() [2/2]

const moab::Range & moab::TempestRemapper::GetMeshVertices ( Remapper::IntersectionContext  ctx) const
inline

Const overload. Get the mesh vertices corresponding to the intersection context. Useful for point-cloud meshes.

Parameters
ctxIntersection context
Returns
MOAB range of mesh vertices

Definition at line 675 of file TempestRemapper.hpp.

676 {
677  switch( ctx )
678  {
680  return m_source_vertices;
682  return m_target_vertices;
685  case Remapper::DEFAULT:
686  default:
687  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_source_vertices );
688  }
689 }

References moab::Remapper::CoveringMesh, moab::Remapper::DEFAULT, m_covering_source_vertices, m_source_vertices, m_target_vertices, MB_SET_ERR_RET_VAL, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

◆ GetOverlapAugmentedEntities()

moab::ErrorCode moab::TempestRemapper::GetOverlapAugmentedEntities ( moab::Range sharedGhostEntities)

Get all the ghosted overlap entities that were accumulated to enable conservation in parallel.

Parameters
sharedGhostEntitiesMOAB range of ghosted overlap entities
Returns
ErrorCode indicating the status of the get operation

Definition at line 743 of file TempestRemapper.cpp.

744 {
745  sharedGhostEntities.clear();
746 #ifdef MOAB_HAVE_MPI
747  moab::ErrorCode rval;
748 
749  // Remove entities in the intersection mesh that are part of the ghosted overlap
750  if( is_parallel )
751  {
752  moab::Range allents;
753  rval = m_interface->get_entities_by_dimension( m_overlap_set, 2, allents );MB_CHK_SET_ERR( rval, "Getting entities dim 2 failed" );
754 
755  moab::Range sharedents;
756  moab::Tag ghostTag;
757  std::vector< int > ghFlags( allents.size() );
758  rval = m_interface->tag_get_handle( "ORIG_PROC", ghostTag );MB_CHK_ERR( rval );
759  rval = m_interface->tag_get_data( ghostTag, allents, &ghFlags[0] );MB_CHK_ERR( rval );
760  for( unsigned i = 0; i < allents.size(); ++i )
761  if( ghFlags[i] >= 0 ) // it means it is a ghost overlap element
762  sharedents.insert( allents[i] ); // this should not participate in smat!
763 
764  allents = subtract( allents, sharedents );
765 
766  // Get connectivity from all ghosted elements and filter out
767  // the vertices that are not owned
768  moab::Range ownedverts, sharedverts;
769  rval = m_interface->get_connectivity( allents, ownedverts );MB_CHK_SET_ERR( rval, "Deleting entities dim 0 failed" );
770  rval = m_interface->get_connectivity( sharedents, sharedverts );MB_CHK_SET_ERR( rval, "Deleting entities dim 0 failed" );
771  sharedverts = subtract( sharedverts, ownedverts );
772  // rval = m_interface->remove_entities(m_overlap_set, sharedents);MB_CHK_SET_ERR(rval,
773  // "Deleting entities dim 2 failed"); rval = m_interface->remove_entities(m_overlap_set,
774  // sharedverts);MB_CHK_SET_ERR(rval, "Deleting entities dim 0 failed");
775 
776  sharedGhostEntities.merge( sharedents );
777  // sharedGhostEntities.merge(sharedverts);
778  }
779 #endif
780  return moab::MB_SUCCESS;
781 }

References moab::Range::clear(), ErrorCode, moab::Range::insert(), MB_CHK_ERR, MB_CHK_SET_ERR, MB_SUCCESS, moab::Range::merge(), moab::Range::size(), and moab::subtract().

Referenced by main().

◆ initialize()

ErrorCode moab::TempestRemapper::initialize ( bool  initialize_fsets = true)
virtual

Initialize the TempestRemapper object internal data structures including the mesh sets and TempestRemap mesh references.

Parameters
initialize_fsetsFlag to initialize the mesh sets (default: true)
Returns
ErrorCode indicating the status of the initialization

Definition at line 53 of file TempestRemapper.cpp.

54 {
55  ErrorCode rval;
56  if( initialize_fsets )
57  {
58  rval = m_interface->create_meshset( moab::MESHSET_SET, m_source_set );MB_CHK_SET_ERR( rval, "Can't create new set" );
59  rval = m_interface->create_meshset( moab::MESHSET_SET, m_target_set );MB_CHK_SET_ERR( rval, "Can't create new set" );
60  rval = m_interface->create_meshset( moab::MESHSET_SET, m_overlap_set );MB_CHK_SET_ERR( rval, "Can't create new set" );
61  }
62  else
63  {
64  m_source_set = 0;
65  m_target_set = 0;
66  m_overlap_set = 0;
67  }
68 
69  is_parallel = false;
70  is_root = true;
71  rank = 0;
72  size = 1;
73 #ifdef MOAB_HAVE_MPI
74  int flagInit;
75  MPI_Initialized( &flagInit );
76  if( flagInit )
77  {
78  assert( m_pcomm != nullptr );
79  rank = m_pcomm->rank();
80  size = m_pcomm->size();
81  is_root = ( rank == 0 );
82  is_parallel = ( size > 1 );
83  // is_parallel = true;
84  }
85  AnnounceOnlyOutputOnRankZero();
86 #endif
87 
88  m_source = nullptr;
89  m_target = nullptr;
90  m_overlap = nullptr;
91  m_covering_source = nullptr;
92 
93  point_cloud_source = false;
94  point_cloud_target = false;
95 
96  return MB_SUCCESS;
97 }

References moab::Interface::create_meshset(), ErrorCode, is_parallel, is_root, m_covering_source, moab::Remapper::m_interface, m_overlap, m_overlap_set, m_source, m_source_set, m_target, m_target_set, MB_CHK_SET_ERR, MB_SUCCESS, MESHSET_SET, point_cloud_source, point_cloud_target, rank, and size.

Referenced by main().

◆ load_tempest_mesh_private()

ErrorCode moab::TempestRemapper::load_tempest_mesh_private ( std::string  inputFilename,
Mesh **  tempest_mesh 
)
private

Load a mesh from disk in TempestRemap format.

Parameters
inputFilenamePath to the input mesh file
tempest_meshPointer to store the loaded TempestRemap mesh
Returns
moab::ErrorCode Status of the load operation

Definition at line 177 of file TempestRemapper.cpp.

178 {
179  const bool outputEnabled = ( TempestRemapper::verbose && is_root );
180  if( outputEnabled ) std::cout << "\nLoading TempestRemap Mesh object from file = " << inputFilename << " ...\n";
181 
182  {
183  NcError error( NcError::silent_nonfatal );
184 
185  try
186  {
187  // Load input mesh
188  if( outputEnabled ) std::cout << "Loading mesh ...\n";
189  Mesh* mesh = new Mesh( inputFilename );
190  mesh->RemoveZeroEdges();
191  if( outputEnabled ) std::cout << "----------------\n";
192 
193  // Validate mesh
194  if( meshValidate )
195  {
196  if( outputEnabled ) std::cout << "Validating mesh ...\n";
197  mesh->Validate();
198  if( outputEnabled ) std::cout << "-------------------\n";
199  }
200 
201  // Construct the edge map on the mesh
202  if( constructEdgeMap )
203  {
204  if( outputEnabled ) std::cout << "Constructing edge map on mesh ...\n";
205  mesh->ConstructEdgeMap( false );
206  if( outputEnabled ) std::cout << "---------------------------------\n";
207  }
208 
209  if( tempest_mesh ) *tempest_mesh = mesh;
210  }
211  catch( Exception& e )
212  {
213  std::cout << "TempestRemap ERROR: " << e.ToString() << "\n";
214  return MB_FAILURE;
215  }
216  catch( ... )
217  {
218  return MB_FAILURE;
219  }
220  }
221  return MB_SUCCESS;
222 }

References constructEdgeMap, moab::error(), is_root, MB_SUCCESS, meshValidate, and verbose.

Referenced by LoadMesh().

◆ LoadMesh()

ErrorCode moab::TempestRemapper::LoadMesh ( Remapper::IntersectionContext  ctx,
std::string  inputFilename,
TempestMeshType  type 
)

Load a mesh from disk of given type and store it under the context specified by the user.

Parameters
ctxIntersection context
inputFilenameFile name of the mesh to load
typeType of mesh to load
Returns
ErrorCode indicating the status of the mesh loading

Definition at line 152 of file TempestRemapper.cpp.

155 {
156  if( ctx == Remapper::SourceMesh )
157  {
158  m_source_type = type;
159  return load_tempest_mesh_private( inputFilename, &m_source );
160  }
161  else if( ctx == Remapper::TargetMesh )
162  {
163  m_target_type = type;
164  return load_tempest_mesh_private( inputFilename, &m_target );
165  }
166  else if( ctx != Remapper::DEFAULT )
167  {
168  m_overlap_type = type;
169  return load_tempest_mesh_private( inputFilename, &m_overlap );
170  }
171  else
172  {
173  MB_CHK_SET_ERR( MB_FAILURE, "Invalid IntersectionContext context provided" );
174  }
175 }

References moab::Remapper::DEFAULT, load_tempest_mesh_private(), m_overlap, m_overlap_type, m_source, m_source_type, m_target, m_target_type, MB_CHK_SET_ERR, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

Referenced by CreateTempestMesh(), and main().

◆ ResetMeshSet()

void moab::TempestRemapper::ResetMeshSet ( Remapper::IntersectionContext  ctx,
moab::EntityHandle  meshSet 
)
inline

Reconstruct mesh, used now only for IO; need a better solution maybe.

Parameters
ctxIntersection context
meshSetMOAB mesh set handle

Definition at line 561 of file TempestRemapper.hpp.

562 {
563  switch( ctx )
564  {
566  delete m_source;
567  m_source = new Mesh;
568  m_source_set = meshSet;
570  m_source->CalculateFaceAreas( false ); // fInputConcave is false ?
571  break;
573  // not needed yet
574  break;
576  // not needed yet
577  break;
579  // not needed yet
580  break;
581  case Remapper::DEFAULT:
582  default:
583  break;
584  }
585 }

References convert_mesh_to_tempest_private(), moab::Remapper::CoveringMesh, moab::Remapper::DEFAULT, m_source, m_source_entities, m_source_set, m_source_vertices, moab::Remapper::OverlapMesh, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

◆ SetMesh()

void moab::TempestRemapper::SetMesh ( Remapper::IntersectionContext  ctx,
Mesh *  mesh,
bool  overwrite = true 
)
inline

Set the TempestRemap mesh object according to the intersection context.

Parameters
ctxIntersection context
meshPointer to the TempestRemap mesh object
overwriteFlag to overwrite the existing mesh (default: true)

Definition at line 531 of file TempestRemapper.hpp.

532 {
533  switch( ctx )
534  {
536  if( !overwrite && m_source ) return;
537  if( overwrite && m_source ) delete m_source;
538  m_source = mesh;
539  break;
541  if( !overwrite && m_target ) return;
542  if( overwrite && m_target ) delete m_target;
543  m_target = mesh;
544  break;
546  if( !overwrite && m_overlap ) return;
547  if( overwrite && m_overlap ) delete m_overlap;
548  m_overlap = mesh;
549  break;
551  if( !overwrite && m_covering_source ) return;
552  if( overwrite && m_covering_source ) delete m_covering_source;
553  m_covering_source = mesh;
554  break;
555  case Remapper::DEFAULT:
556  default:
557  break;
558  }
559 }

References moab::Remapper::CoveringMesh, moab::Remapper::DEFAULT, m_covering_source, m_overlap, m_source, m_target, moab::Remapper::OverlapMesh, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

Referenced by CreateTempestMesh().

◆ SetMeshSet()

void moab::TempestRemapper::SetMeshSet ( Remapper::IntersectionContext  ctx,
moab::EntityHandle  mset,
moab::Range entities = nullptr 
)

Set the mesh set according to the intersection context.

Parameters
ctxIntersection context
msetMOAB mesh set handle
entitiesMOAB range of entities (optional)

Definition at line 970 of file TempestRemapper.cpp.

973 {
974 
975  if( ctx == Remapper::SourceMesh ) // should not be used
976  {
977  m_source_set = mset;
979  }
980  else if( ctx == Remapper::TargetMesh )
981  {
982  m_target_set = mset;
984  }
985  else if( ctx == Remapper::CoveringMesh )
986  {
987  m_covering_source_set = mset;
989  }
990  else
991  {
992  // nothing to do really..
993  return;
994  }
995 }

References moab::Remapper::CoveringMesh, entities, m_covering_source_entities, m_covering_source_set, m_source_entities, m_source_set, m_target_entities, m_target_set, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

◆ SetMeshType()

void moab::TempestRemapper::SetMeshType ( Remapper::IntersectionContext  ctx,
const std::vector< int > &  metadata 
)
inline

Set the mesh type corresponding to the intersection context.

Parameters
ctxIntersection context
metadataVector of mesh type metadata

Definition at line 691 of file TempestRemapper.hpp.

692 {
693  switch( ctx )
694  {
696  m_source_type = static_cast< moab::TempestRemapper::TempestMeshType >( metadata[0] );
697  if( metadata[0] == 1 ) // RLL mesh
698  {
699  m_source_metadata.resize( 2 );
700  m_source_metadata[0] = metadata[1];
701  m_source_metadata[1] = metadata[2];
702  }
703  else
704  {
705  m_source_metadata.resize( 1 );
706  m_source_metadata[0] = metadata[1];
707  }
708  break;
710  m_target_type = static_cast< moab::TempestRemapper::TempestMeshType >( metadata[0] );
711  if( metadata[0] == 1 ) // RLL mesh
712  {
713  m_target_metadata.resize( 2 );
714  m_target_metadata[0] = metadata[1];
715  m_target_metadata[1] = metadata[2];
716  }
717  else
718  {
719  m_target_metadata.resize( 1 );
720  m_target_metadata[0] = metadata[1];
721  }
722  break;
725  default:
726  break;
727  }
728 }

References m_overlap_type, m_source_metadata, m_source_type, m_target_metadata, m_target_type, OVERLAP_FILES, moab::Remapper::OverlapMesh, moab::Remapper::SourceMesh, and moab::Remapper::TargetMesh.

Referenced by CreateTempestMesh().

◆ WriteTempestIntersectionMesh()

moab::ErrorCode moab::TempestRemapper::WriteTempestIntersectionMesh ( std::string  strOutputFileName,
const bool  fAllParallel,
const bool  fInputConcave,
const bool  fOutputConcave 
)

Gather the overlap mesh and associated source/target data and write it out to disk using the TempestRemap output interface. This information can then be used with the "GenerateOfflineMap" tool in TempestRemap as needed.

Parameters
strOutputFileNameOutput file name
fAllParallelFlag to write all parallel data (default: false)
fInputConcaveFlag to indicate if the input mesh is concave (default: false)
fOutputConcaveFlag to indicate if the output mesh is concave (default: false)
Returns
ErrorCode indicating the status of the write operation

Definition at line 934 of file TempestRemapper.cpp.

938 {
939  // Let us alos write out the TempestRemap equivalent so that we can do some verification checks
940  if( fAllParallel )
941  {
942  if( is_root && size == 1 )
943  {
944  this->m_source->CalculateFaceAreas( fInputConcave );
945  this->m_target->CalculateFaceAreas( fOutputConcave );
946  this->m_overlap->Write( strOutputFileName.c_str(), NcFile::Netcdf4 );
947  }
948  else
949  {
950  // Perform reduction and write from root processor
951  // if ( is_root )
952  // std::cout << "--- PARALLEL IMPLEMENTATION is NOT AVAILABLE yet ---\n";
953 
954  this->m_source->CalculateFaceAreas( fInputConcave );
955  this->m_covering_source->CalculateFaceAreas( fInputConcave );
956  this->m_target->CalculateFaceAreas( fOutputConcave );
957  this->m_overlap->Write( strOutputFileName.c_str(), NcFile::Netcdf4 );
958  }
959  }
960  else
961  {
962  this->m_source->CalculateFaceAreas( fInputConcave );
963  this->m_target->CalculateFaceAreas( fOutputConcave );
964  this->m_overlap->Write( strOutputFileName.c_str(), NcFile::Netcdf4 );
965  }
966 
967  return moab::MB_SUCCESS;
968 }

References MB_SUCCESS, and size.

Friends And Related Function Documentation

◆ TempestOnlineMap

friend class TempestOnlineMap
friend

Definition at line 66 of file TempestRemapper.hpp.

Member Data Documentation

◆ constructEdgeMap

bool moab::TempestRemapper::constructEdgeMap

Flag to construct the edge map within the TempestRemap data structures.

If set to true, the edge map will be constructed within the TempestRemap data structures.

Definition at line 382 of file TempestRemapper.hpp.

Referenced by convert_mesh_to_tempest_private(), load_tempest_mesh_private(), and main().

◆ is_parallel

bool moab::TempestRemapper::is_parallel
private

◆ is_root

◆ m_area_method

IntxAreaUtils::AreaMethod moab::TempestRemapper::m_area_method
private

Definition at line 505 of file TempestRemapper.hpp.

◆ m_covering_source

Mesh* moab::TempestRemapper::m_covering_source
private

◆ m_covering_source_entities

moab::Range moab::TempestRemapper::m_covering_source_entities
private

◆ m_covering_source_set

moab::EntityHandle moab::TempestRemapper::m_covering_source_set
private

◆ m_covering_source_vertices

moab::Range moab::TempestRemapper::m_covering_source_vertices
private

◆ m_overlap

Mesh* moab::TempestRemapper::m_overlap
private

◆ m_overlap_entities

moab::Range moab::TempestRemapper::m_overlap_entities
private

◆ m_overlap_set

moab::EntityHandle moab::TempestRemapper::m_overlap_set
private

◆ m_overlap_type

TempestMeshType moab::TempestRemapper::m_overlap_type
private

Definition at line 487 of file TempestRemapper.hpp.

Referenced by ConvertTempestMesh(), GetMeshType(), LoadMesh(), and SetMeshType().

◆ m_sorted_overlap_order

std::vector< std::pair< int, int > > moab::TempestRemapper::m_sorted_overlap_order
private

Definition at line 490 of file TempestRemapper.hpp.

◆ m_source

◆ m_source_entities

moab::Range moab::TempestRemapper::m_source_entities
private

◆ m_source_metadata

std::vector< int > moab::TempestRemapper::m_source_metadata
private

Definition at line 473 of file TempestRemapper.hpp.

Referenced by SetMeshType().

◆ m_source_set

moab::EntityHandle moab::TempestRemapper::m_source_set
private

◆ m_source_type

TempestMeshType moab::TempestRemapper::m_source_type
private

Definition at line 467 of file TempestRemapper.hpp.

Referenced by ConvertTempestMesh(), GetMeshType(), LoadMesh(), and SetMeshType().

◆ m_source_vertices

moab::Range moab::TempestRemapper::m_source_vertices
private

◆ m_target

Mesh* moab::TempestRemapper::m_target
private

◆ m_target_entities

◆ m_target_metadata

std::vector< int > moab::TempestRemapper::m_target_metadata
private

Definition at line 483 of file TempestRemapper.hpp.

Referenced by SetMeshType().

◆ m_target_set

moab::EntityHandle moab::TempestRemapper::m_target_set
private

◆ m_target_type

TempestMeshType moab::TempestRemapper::m_target_type
private

Definition at line 477 of file TempestRemapper.hpp.

Referenced by ConvertTempestMesh(), GetMeshType(), LoadMesh(), and SetMeshType().

◆ m_target_vertices

moab::Range moab::TempestRemapper::m_target_vertices
private

◆ max_source_edges

int moab::TempestRemapper::max_source_edges
private

Definition at line 471 of file TempestRemapper.hpp.

Referenced by ConstructCoveringSet().

◆ max_target_edges

int moab::TempestRemapper::max_target_edges
private

Definition at line 481 of file TempestRemapper.hpp.

Referenced by ConstructCoveringSet().

◆ mbintx

moab::Intx2MeshOnSphere* moab::TempestRemapper::mbintx
private

Definition at line 493 of file TempestRemapper.hpp.

Referenced by ComputeOverlapMesh(), and ConstructCoveringSet().

◆ meshValidate

bool moab::TempestRemapper::meshValidate

Flag to enable mesh validation after loading from file.

If set to true, the mesh will be validated after it is loaded from a file.

Definition at line 374 of file TempestRemapper.hpp.

Referenced by load_tempest_mesh_private(), and main().

◆ offlineWorkflow

const bool moab::TempestRemapper::offlineWorkflow

Flag indicating whether the workflow is in offline mode.

This flag is used to determine the context of the workflow, specifically whether it is running in an offline mode (mbtempest).

Definition at line 367 of file TempestRemapper.hpp.

Referenced by convert_mesh_to_tempest_private().

◆ point_cloud_source

bool moab::TempestRemapper::point_cloud_source
private

Definition at line 472 of file TempestRemapper.hpp.

Referenced by clear(), ConvertMeshToTempest(), GetIMasks(), and initialize().

◆ point_cloud_target

bool moab::TempestRemapper::point_cloud_target
private

◆ rank

◆ rrmgrids

bool moab::TempestRemapper::rrmgrids
private

Definition at line 507 of file TempestRemapper.hpp.

Referenced by ComputeOverlapMesh(), and ConstructCoveringSet().

◆ size

int moab::TempestRemapper::size
private

◆ verbose

const bool moab::TempestRemapper::verbose = true
static

Global verbosity flag.

This flag controls the verbosity of the output. If set to true, more detailed output will be generated.

Definition at line 390 of file TempestRemapper.hpp.

Referenced by convert_tempest_mesh_private(), ConvertMeshToTempest(), ConvertTempestMesh(), and load_tempest_mesh_private().


The documentation for this class was generated from the following files: