Mesh Oriented datABase  (version 5.6.0)
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 = nullptr
 
TempestMeshType m_source_type
 
moab::Range m_source_entities
 
moab::Range m_source_vertices
 
moab::EntityHandle m_source_set = 0
 
int max_source_edges = 0
 
bool point_cloud_source = false
 
std::vector< int > m_source_metadata
 
Mesh * m_target = nullptr
 
TempestMeshType m_target_type
 
moab::Range m_target_entities
 
moab::Range m_target_vertices
 
moab::EntityHandle m_target_set = 0
 
int max_target_edges = 0
 
bool point_cloud_target = false
 
std::vector< int > m_target_metadata
 
Mesh * m_overlap = nullptr
 
TempestMeshType m_overlap_type = DEFAULT
 
moab::Range m_overlap_entities
 
moab::EntityHandle m_overlap_set = 0
 
std::vector< std::pair< int, int > > m_sorted_overlap_order
 
moab::Intx2MeshOnSpherembintx = nullptr
 
Mesh * m_covering_source = nullptr
 
moab::EntityHandle m_covering_source_set = 0
 
moab::Range m_covering_source_entities
 
moab::Range m_covering_source_vertices
 
IntxAreaUtils::AreaMethod m_area_method = IntxAreaUtils::lHuiller
 
bool rrmgrids = false
 
bool is_parallel = false
 
bool is_root = false
 
int rank = 0
 
int size = 0
 

Friends

class TempestOnlineMap
 

Additional Inherited Members

- Protected Attributes inherited from moab::Remapper
Interfacem_interface
 

Detailed Description

Definition at line 40 of file TempestRemapper.hpp.

Member Enumeration Documentation

◆ TempestMeshType

Enumerator
DEFAULT 
CS 
RLL 
ICO 
ICOD 
OVERLAP_FILES 
OVERLAP_MEMORY 
OVERLAP_MOAB 

Definition at line 61 of file TempestRemapper.hpp.

62  {
63  DEFAULT = -1,
64  CS = 0,
65  RLL = 1,
66  ICO = 2,
67  ICOD = 3,
68  OVERLAP_FILES = 4,
69  OVERLAP_MEMORY = 5,
70  OVERLAP_MOAB = 6
71  };

Constructor & Destructor Documentation

◆ TempestRemapper()

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

Definition at line 47 of file TempestRemapper.hpp.

48  : Remapper( mbInt ),
49 #endif
50  offlineWorkflow( offlineMode ), meshValidate( false ), constructEdgeMap( false ), m_source_type( DEFAULT ),
52  {
53 #ifdef MOAB_HAVE_MPI
54  AnnounceOnlyOutputOnRankZero();
55 #endif
56  }

◆ ~TempestRemapper()

moab::TempestRemapper::~TempestRemapper ( )
virtual

Definition at line 100 of file TempestRemapper.cpp.

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

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 1026 of file TempestRemapper.cpp.

1030 {
1031  assert( idtag );
1032 
1033  ErrorCode rval;
1034  Range entities;
1035  MB_CHK_SET_ERR( m_interface->get_entities_by_dimension( this_set, dimension, entities ), "Failed to get entities" );
1036 
1037  if( entities.size() == 0 ) return moab::MB_SUCCESS;
1038 
1039  int idoffset = start_id;
1040  std::vector< int > gid( entities.size() );
1041  for( unsigned i = 0; i < entities.size(); ++i )
1042  gid[i] = idoffset++;
1043 
1044  MB_CHK_ERR( m_interface->tag_set_data( idtag, entities, &gid[0] ) );
1045 
1046  return moab::MB_SUCCESS;
1047 }

References ErrorCode, moab::Interface::get_entities_by_dimension(), moab::Remapper::m_interface, MB_CHK_ERR, MB_CHK_SET_ERR, MB_SUCCESS, moab::Range::size(), 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 105 of file TempestRemapper.cpp.

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

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 1385 of file TempestRemapper.cpp.

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

References AugmentOverlapSet(), moab::Range::begin(), ConvertOverlapMeshSourceOrdered(), moab::AEntityFactory::create_vert_elem_adjacencies(), dbgprint, moab::Range::end(), moab::Range::erase(), 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 1238 of file TempestRemapper.cpp.

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

References moab::Interface::add_entities(), moab::AdaptiveKDTree::build_tree(), ConvertAllMeshesToTempest(), moab::Interface::create_meshset(), 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, MB_SUCCESS, 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 644 of file TempestRemapper.cpp.

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

References moab::Range::begin(), moab::Range::clear(), moab::Range::compactness(), constructEdgeMap, moab::Range::end(), 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 254 of file TempestRemapper.cpp.

259 {
260  const bool outputEnabled = ( TempestRemapper::verbose && is_root );
261  const NodeVector& nodes = mesh->nodes;
262  const FaceVector& faces = mesh->faces;
263 
264  moab::DebugOutput dbgprint( std::cout, this->rank, 0 );
265  dbgprint.set_prefix( "[TempestToMOAB]: " );
266 
267  ReadUtilIface* iface;
268  MB_CHK_SET_ERR( m_interface->query_interface( iface ), "Can't get reader interface" );
269 
270  Tag gidTag = m_interface->globalId_tag();
271 
272  // Set the data for the vertices
273  std::vector< double* > arrays;
274  std::vector< int > gidsv( nodes.size() );
275  EntityHandle startv;
276  MB_CHK_SET_ERR( iface->get_node_coords( 3, nodes.size(), 0, startv, arrays ), "Can't get node coords" );
277  for( unsigned iverts = 0; iverts < nodes.size(); ++iverts )
278  {
279  const Node& node = nodes[iverts];
280  arrays[0][iverts] = node.x;
281  arrays[1][iverts] = node.y;
282  arrays[2][iverts] = node.z;
283  gidsv[iverts] = iverts + 1;
284  }
285  Range mbverts( startv, startv + nodes.size() - 1 );
286  MB_CHK_SET_ERR( m_interface->add_entities( mesh_set, mbverts ), "Can't add entities" );
287  MB_CHK_SET_ERR( m_interface->tag_set_data( gidTag, mbverts, &gidsv[0] ), "Can't set global_id tag" );
288 
289  gidsv.clear();
290  entities.clear();
291 
292  Tag srcParentTag, tgtParentTag;
293  std::vector< int > srcParent( faces.size(), -1 ), tgtParent( faces.size(), -1 );
294  std::vector< int > gidse( faces.size(), -1 );
295  bool storeParentInfo = ( mesh->vecSourceFaceIx.size() > 0 );
296 
297  if( storeParentInfo )
298  {
299  int defaultInt = -1;
300  MB_CHK_SET_ERR( m_interface->tag_get_handle( "TargetParent", 1, MB_TYPE_INTEGER, tgtParentTag,
301  MB_TAG_DENSE | MB_TAG_CREAT, &defaultInt ),
302  "can't create positive tag" );
303 
304  MB_CHK_SET_ERR( m_interface->tag_get_handle( "SourceParent", 1, MB_TYPE_INTEGER, srcParentTag,
305  MB_TAG_DENSE | MB_TAG_CREAT, &defaultInt ),
306  "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  MB_CHK_SET_ERR( m_interface->create_element( MBTRI, &conn[0], num_v_per_elem, mbcells[ifaces] ),
338  "Can't get element connectivity" );
339  ntris++;
340  break;
341  case 4:
342  // if( outputEnabled )
343  // dbgprint.printf( 0, "....Block %d: Quadrilateral Elements [%u].\n", iBlock++, nPolys[iType] );
344  MB_CHK_SET_ERR( m_interface->create_element( MBQUAD, &conn[0], num_v_per_elem, mbcells[ifaces] ),
345  "Can't get element connectivity" );
346  nquads++;
347  break;
348  default:
349  // if( outputEnabled )
350  // dbgprint.printf( 0, "....Block %d: Polygonal [%u] Elements [%u].\n", iBlock++, iType,
351  // nPolys[iType] );
352  MB_CHK_SET_ERR( m_interface->create_element( MBPOLYGON, &conn[0], num_v_per_elem, mbcells[ifaces] ),
353  "Can't get element connectivity" );
354  npolys++;
355  break;
356  }
357 
358  gidse[ifaces] = ifaces + 1;
359 
360  if( storeParentInfo )
361  {
362  srcParent[ifaces] = mesh->vecSourceFaceIx[ifaces] + 1;
363  tgtParent[ifaces] = mesh->vecTargetFaceIx[ifaces] + 1;
364  }
365  }
366 
367  if( ntris ) dbgprint.printf( 0, "....Triangular Elements [%u].\n", ntris );
368  if( nquads ) dbgprint.printf( 0, "....Quadrangular Elements [%u].\n", nquads );
369  if( npolys ) dbgprint.printf( 0, "....Polygonal Elements [%u].\n", npolys );
370 
371  MB_CHK_SET_ERR( m_interface->add_entities( mesh_set, &mbcells[0], mbcells.size() ), "Could not add entities" );
372 
373  MB_CHK_SET_ERR( m_interface->tag_set_data( gidTag, &mbcells[0], mbcells.size(), &gidse[0] ),
374  "Can't set global_id tag" );
375 #ifdef MOAB_HAVE_MPI
376  MB_CHK_SET_ERR( m_pcomm->assign_global_ids(mesh_set, 2, 1, false, true, false ), "Unable to set global IDs" );
377 #endif
378 
379  if( storeParentInfo )
380  {
381  MB_CHK_SET_ERR( m_interface->tag_set_data( srcParentTag, &mbcells[0], mbcells.size(), &srcParent[0] ),
382  "Can't set tag data" );
383  MB_CHK_SET_ERR( m_interface->tag_set_data( tgtParentTag, &mbcells[0], mbcells.size(), &tgtParent[0] ),
384  "Can't set tag data" );
385  }
386 
387  // insert from mbcells to entities to preserve ordering
388  std::copy( mbcells.begin(), mbcells.end(), range_inserter( entities ) );
389  }
390 
391  if( vertices ) *vertices = mbverts;
392 
393  return MB_SUCCESS;
394 }

References moab::Interface::add_entities(), moab::Range::clear(), moab::Interface::create_element(), dbgprint, 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 566 of file TempestRemapper.cpp.

567 {
568  // now, let us ensure we have a valid source and target mesh objects
569  // if not, convert the source and target meshes to TempestRemap format
570  if( this->m_source == nullptr )
571  {
572  // Convert the covering mesh to TempestRemap format
574  "Can't convert source mesh to TempestRemap format" );
575  }
576  if( this->m_covering_source == nullptr )
577  {
578  // Convert the covering mesh to TempestRemap format
580  "Can't convert source coverage mesh to TempestRemap format" );
581  }
582  if( this->m_target == nullptr )
583  {
584  // Convert the covering mesh to TempestRemap format
586  "Can't convert target mesh to TempestRemap format" );
587  }
588 
589  return moab::MB_SUCCESS;
590 }

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 592 of file TempestRemapper.cpp.

593 {
594  const bool outputEnabled = ( TempestRemapper::verbose && is_root );
595 
596  // create a debug output object and set a prefix
597  moab::DebugOutput dbgprint( std::cout, this->rank, 0 );
598  dbgprint.set_prefix( "[MOABToTempest]: " );
599 
600  if( ctx == Remapper::SourceMesh )
601  {
602  if( !m_source ) m_source = new Mesh();
603  if( outputEnabled ) dbgprint.printf( 0, "Converting (source) MOAB to TempestRemap Mesh representation ...\n" );
606  "Can't convert source mesh to Tempest" );
607  if( m_source_entities.size() == 0 && m_source_vertices.size() != 0 )
608  {
609  this->point_cloud_source = true;
610  }
611  }
612  else if( ctx == Remapper::CoveringMesh )
613  {
614  if( !m_covering_source ) m_covering_source = new Mesh();
615  if( outputEnabled )
616  dbgprint.printf( 0, "Converting (covering source) MOAB to TempestRemap Mesh representation ...\n" );
619  "Can't convert convering source mesh to TempestRemap format" );
620  }
621  else if( ctx == Remapper::TargetMesh )
622  {
623  if( !m_target ) m_target = new Mesh();
624  if( outputEnabled ) dbgprint.printf( 0, "Converting (target) MOAB to TempestRemap Mesh representation ...\n" );
627  "Can't convert target mesh to Tempest" );
628  if( m_target_entities.size() == 0 && m_target_vertices.size() != 0 ) this->point_cloud_target = true;
629  }
630  else if( ctx == Remapper::OverlapMesh ) // Overlap mesh
631  {
632  if( !m_overlap ) m_overlap = new Mesh();
633  if( outputEnabled ) dbgprint.printf( 0, "Converting (overlap) MOAB to TempestRemap Mesh representation ...\n" );
634  MB_CHK_SET_ERR( ConvertOverlapMeshSourceOrdered(), "Can't convert overlap mesh to Tempest" );
635  }
636  else
637  {
638  MB_CHK_SET_ERR( MB_FAILURE, "Invalid IntersectionContext context provided" );
639  }
640 
641  return moab::MB_SUCCESS;
642 }

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(), anonymous_namespace{mbtempest.cpp}::handleOverlapMOAB(), 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 801 of file TempestRemapper.cpp.

802 {
805  size_t n_overlap_entitites = m_overlap_entities.size();
806 
807  // Allocate for the overlap mesh
808  if( !m_overlap ) m_overlap = new Mesh();
809 
810  std::vector< std::array< int, 3 > > sorted_overlap_order( n_overlap_entitites,
811  std::array< int, 3 >( { -1, -1, -1 } ) );
812  {
813  Tag srcParentTag, tgtParentTag;
814  MB_CHK_ERR( m_interface->tag_get_handle( "SourceParent", srcParentTag ) );
815  MB_CHK_ERR( m_interface->tag_get_handle( "TargetParent", tgtParentTag ) );
816  // Overlap mesh: resize the source and target connection arrays
817  m_overlap->vecTargetFaceIx.resize( n_overlap_entitites );
818  m_overlap->vecSourceFaceIx.resize( n_overlap_entitites );
819 
820  // We need a global to local numbering
821  Tag gidtag = m_interface->globalId_tag();
822  std::vector< int > gids_src( m_covering_source_entities.size(), -1 ), gids_tgt( m_target_entities.size(), -1 );
823  MB_CHK_ERR( m_interface->tag_get_data( gidtag, m_covering_source_entities, gids_src.data() ) );
824  MB_CHK_ERR( m_interface->tag_get_data( gidtag, m_target_entities, gids_tgt.data() ) );
825 
826 // #define USE_SORTED_GIDS
827 #ifdef USE_SORTED_GIDS
828  // let us sort the global indices so that we always have a consistent ordering
829  std::sort( gids_src.begin(), gids_src.end() );
830  std::sort( gids_tgt.begin(), gids_tgt.end() );
831 
832  auto find_lid = []( std::vector< int >& gids, int gid ) -> int {
833  // auto it = std::equal_range( gids.begin(), gids.end(), gid );
834  // return ( ( it.first != it.second ) ? std::distance( gids.begin(), it.first ) : -1 );
835 
836  auto it = std::lower_bound( gids.begin(), gids.end(), gid );
837  return ( it != gids.end() ? std::distance( gids.begin(), it ) : -1 );
838  };
839 #else
840  auto find_lid = [this]( std::vector< int >& gids, int gid ) -> int {
841  if (offlineWorkflow) return gid-1;
842  auto it = std::find( gids.begin(), gids.end(), gid );
843  return ( it != gids.end() ? std::distance( gids.begin(), it ) : -1 );
844  };
845 #endif
846 
847  std::vector< int > ghFlags;
848  if( is_parallel )
849  {
850  Tag ghostTag;
851  ghFlags.resize( n_overlap_entitites );
852  MB_CHK_SET_ERR( m_interface->tag_get_handle( "ORIG_PROC", ghostTag ), "Could not find ORIG_PROC tag" );
853  MB_CHK_ERR( m_interface->tag_get_data( ghostTag, m_overlap_entities, ghFlags.data() ) );
854  }
855 
856  // Overlap mesh: resize the source and target connection arrays
857  std::vector< int > rbids_src( n_overlap_entitites ), rbids_tgt( n_overlap_entitites );
858  MB_CHK_ERR( m_interface->tag_get_data( srcParentTag, m_overlap_entities, rbids_src.data() ) );
859  MB_CHK_ERR( m_interface->tag_get_data( tgtParentTag, m_overlap_entities, rbids_tgt.data() ) );
860 
861  for( size_t ix = 0; ix < n_overlap_entitites; ++ix )
862  {
863  std::get< 0 >( sorted_overlap_order[ix] ) = ix;
864  std::get< 1 >( sorted_overlap_order[ix] ) = find_lid( gids_src, rbids_src[ix] );
865  assert( std::get< 1 >( sorted_overlap_order[ix] ) >= 0 );
866  if( is_parallel && ghFlags[ix] >= 0 )
867  {
868  // Ghost overlap element: its target cell lives on the rank that owns this element.
869  // Weight contributions for this element are computed on that owning rank (where the
870  // element has ORIG_PROC=-1 and a valid local target face index). Using -1 here
871  // ensures the element is skipped on this rank to avoid double-counting.
872  std::get< 2 >( sorted_overlap_order[ix] ) = -1;
873  }
874  else
875  std::get< 2 >( sorted_overlap_order[ix] ) = find_lid( gids_tgt, rbids_tgt[ix] );
876  }
877  // now sort the overlap elements such that they are ordered by source parent first
878  // and then target parent next
879  std::sort( sorted_overlap_order.begin(), sorted_overlap_order.end(), IntPairComparator );
880 
881  for( unsigned ie = 0; ie < n_overlap_entitites; ++ie )
882  {
883  m_overlap->vecSourceFaceIx[ie] = std::get< 1 >( sorted_overlap_order[ie] );
884  m_overlap->vecTargetFaceIx[ie] = std::get< 2 >( sorted_overlap_order[ie] );
885  }
886  }
887 
888  FaceVector& faces = m_overlap->faces;
889  faces.resize( n_overlap_entitites );
890 
891  Range verts;
892  // let us now get the vertices from all the elements
894 
895  std::map< EntityHandle, int > indxMap;
896  {
897  int j = 0;
898  for( Range::iterator it = verts.begin(); it != verts.end(); ++it )
899  indxMap[*it] = j++;
900  }
901 
902  for( unsigned ifac = 0; ifac < m_overlap_entities.size(); ++ifac )
903  {
904  const unsigned iface = std::get< 0 >( sorted_overlap_order[ifac] );
905  Face& face = faces[ifac];
907 
908  // get the connectivity for each edge
909  const EntityHandle* connectface;
910  int nnodesf;
911  MB_CHK_ERR( m_interface->get_connectivity( ehandle, connectface, nnodesf ) );
912 
913  face.edges.resize( nnodesf );
914  for( int iverts = 0; iverts < nnodesf; ++iverts )
915  {
916  int indx = indxMap[connectface[iverts]];
917  assert( indx >= 0 );
918  face.SetNode( iverts, indx );
919  }
920  }
921  indxMap.clear();
922  sorted_overlap_order.clear();
923 
924  unsigned nnodes = verts.size();
925  NodeVector& nodes = m_overlap->nodes;
926  nodes.resize( nnodes );
927 
928  // Set the data for the vertices
929  std::vector< double > coordx( nnodes ), coordy( nnodes ), coordz( nnodes );
930  MB_CHK_ERR( m_interface->get_coords( verts, &coordx[0], &coordy[0], &coordz[0] ) );
931  for( unsigned inode = 0; inode < nnodes; ++inode )
932  {
933  Node& node = nodes[inode];
934  node.x = coordx[inode];
935  node.y = coordy[inode];
936  node.z = coordz[inode];
937  }
938  coordx.clear();
939  coordy.clear();
940  coordz.clear();
941  verts.clear();
942 
943  // ideally, we should do these in MOAB after intersction computation
944  // m_overlap->RemoveZeroEdges();
945  // m_overlap->RemoveCoincidentNodes( false );
946 
947  // Generate reverse node array and edge map
948  // if ( constructEdgeMap ) m_overlap->ConstructEdgeMap(false);
949  // m_overlap->ConstructReverseNodeArray();
950 
951  // For now, comment out validation; not needed
952  // m_overlap->Validate();
953 
954  // all done. return success
955  return MB_SUCCESS;
956 }

References moab::Range::begin(), moab::Range::clear(), moab::Range::end(), 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, offlineWorkflow, 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 225 of file TempestRemapper.cpp.

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

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 anonymous_namespace{mbtempest.cpp}::convertAndWriteMOABMesh(), and 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 1058 of file TempestRemapper.cpp.

1063 {
1064  const int csResolution = std::sqrt( ntot_elements / 6.0 );
1065  if( csResolution * csResolution * 6 != ntot_elements ) return MB_INVALID_SIZE;
1066 
1067  // Create a temporary Cubed-Sphere mesh
1068  // NOTE: This will not work for RRM grids. Need to run HOMME for that case anyway
1069  Mesh csMesh;
1070  if( GenerateCSMesh( csMesh, csResolution, "", "NetCDF4" ) )
1071  MB_CHK_SET_ERR( moab::MB_FAILURE, // unsuccessful call
1072  "Failed to generate CS mesh through TempestRemap" );
1073 
1074  // let us now generate the mesh metadata
1075  if( this->GenerateMeshMetadata( csMesh, ntot_elements, ents, secondary_ents, dofTagName, nP ) )
1076  MB_CHK_SET_ERR( moab::MB_FAILURE, "Failed in call to GenerateMeshMetadata" ); // unsuccessful call
1077 
1078  return moab::MB_SUCCESS;
1079 }

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 1081 of file TempestRemapper.cpp.

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

References moab::Range::begin(), moab::Range::end(), moab::Interface::get_coords(), moab::Range::insert(), moab::Remapper::m_interface, MB_CHK_SET_ERR, MB_INVALID_SIZE, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_INTEGER, moab::Range::size(), 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 755 of file TempestRemapper.hpp.

756 {
757  return m_covering_source;
758 }

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 760 of file TempestRemapper.hpp.

761 {
762  return m_covering_source_set;
763 }

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 2192 of file TempestRemapper.cpp.

2193 {
2194  Tag maskTag;
2195  // it should have been created already, if not, we might have a problem
2196  int def_val = 1;
2198  &def_val ),
2199  "Trouble creating GRID_IMASK tag" );
2200 
2201  switch( ctx )
2202  {
2203  case Remapper::SourceMesh: {
2204  if( point_cloud_source )
2205  {
2206  masks.resize( m_source_vertices.size() );
2207  MB_CHK_SET_ERR( m_interface->tag_get_data( maskTag, m_source_vertices, &masks[0] ),
2208  "Trouble getting GRID_IMASK tag" );
2209  }
2210  else
2211  {
2212  masks.resize( m_source_entities.size() );
2213  MB_CHK_SET_ERR( m_interface->tag_get_data( maskTag, m_source_entities, &masks[0] ),
2214  "Trouble getting GRID_IMASK tag" );
2215  }
2216  return MB_SUCCESS;
2217  }
2218  case Remapper::TargetMesh: {
2219  if( point_cloud_target )
2220  {
2221  masks.resize( m_target_vertices.size() );
2222  MB_CHK_SET_ERR( m_interface->tag_get_data( maskTag, m_target_vertices, &masks[0] ),
2223  "Trouble getting GRID_IMASK tag" );
2224  }
2225  else
2226  {
2227  masks.resize( m_target_entities.size() );
2228  MB_CHK_SET_ERR( m_interface->tag_get_data( maskTag, m_target_entities, &masks[0] ),
2229  "Trouble getting GRID_IMASK tag" );
2230  }
2231  return MB_SUCCESS;
2232  }
2234  case Remapper::OverlapMesh:
2235  default:
2236  return MB_SUCCESS;
2237  }
2238 }

References moab::Remapper::CoveringMesh, 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 522 of file TempestRemapper.hpp.

523 {
524  switch( ctx )
525  {
527  return m_source;
529  return m_target;
531  return m_overlap;
533  return m_covering_source;
534  case Remapper::DEFAULT:
535  default:
536  return NULL;
537  }
538 }

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 anonymous_namespace{mbtempest.cpp}::handleOverlapMemory(), anonymous_namespace{mbtempest.cpp}::handleOverlapMOAB(), 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 632 of file TempestRemapper.hpp.

633 {
634  switch( ctx )
635  {
637  return m_source_entities;
639  return m_target_entities;
641  return m_overlap_entities;
644  case Remapper::DEFAULT:
645  default:
646  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_overlap_entities );
647  }
648 }

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 650 of file TempestRemapper.hpp.

651 {
652  switch( ctx )
653  {
655  return m_source_entities;
657  return m_target_entities;
659  return m_overlap_entities;
662  case Remapper::DEFAULT:
663  default:
664  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_overlap_entities );
665  }
666 }

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 596 of file TempestRemapper.hpp.

597 {
598  switch( ctx )
599  {
601  return m_source_set;
603  return m_target_set;
605  return m_overlap_set;
607  return m_covering_source_set;
608  case Remapper::DEFAULT:
609  default:
610  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_overlap_set );
611  }
612 }

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 anonymous_namespace{mbtempest.cpp}::convertAndWriteMOABMesh(), anonymous_namespace{mbtempest.cpp}::handleOverlapMemory(), anonymous_namespace{mbtempest.cpp}::handleOverlapMOAB(), 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 614 of file TempestRemapper.hpp.

615 {
616  switch( ctx )
617  {
619  return m_source_set;
621  return m_target_set;
623  return m_overlap_set;
625  return m_covering_source_set;
626  case Remapper::DEFAULT:
627  default:
628  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_overlap_set );
629  }
630 }

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 739 of file TempestRemapper.hpp.

740 {
741  switch( ctx )
742  {
744  return m_source_type;
746  return m_target_type;
748  return m_overlap_type;
749  case Remapper::DEFAULT:
750  default:
752  }
753 }

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 668 of file TempestRemapper.hpp.

669 {
670  switch( ctx )
671  {
673  return m_source_vertices;
675  return m_target_vertices;
678  case Remapper::DEFAULT:
679  default:
680  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_source_vertices );
681  }
682 }

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 684 of file TempestRemapper.hpp.

685 {
686  switch( ctx )
687  {
689  return m_source_vertices;
691  return m_target_vertices;
694  case Remapper::DEFAULT:
695  default:
696  MB_SET_ERR_RET_VAL( "Invalid context passed to GetMeshSet", m_source_vertices );
697  }
698 }

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 762 of file TempestRemapper.cpp.

763 {
764  sharedGhostEntities.clear();
765 #ifdef MOAB_HAVE_MPI
766 
767  // Remove entities in the intersection mesh that are part of the ghosted overlap
768  if( is_parallel )
769  {
770  moab::Range allents;
772  "Getting entities dim 2 failed" );
773 
774  moab::Range sharedents;
775  moab::Tag ghostTag;
776  std::vector< int > ghFlags( allents.size() );
777  MB_CHK_ERR( m_interface->tag_get_handle( "ORIG_PROC", ghostTag ) );
778  MB_CHK_ERR( m_interface->tag_get_data( ghostTag, allents, &ghFlags[0] ) );
779  for( unsigned i = 0; i < allents.size(); ++i )
780  if( ghFlags[i] >= 0 ) // it means it is a ghost overlap element
781  sharedents.insert( allents[i] ); // this should not participate in smat!
782 
783  allents = subtract( allents, sharedents );
784 
785  // Get connectivity from all ghosted elements and filter out
786  // the vertices that are not owned
787  moab::Range ownedverts, sharedverts;
788  MB_CHK_SET_ERR( m_interface->get_connectivity( allents, ownedverts ), "Deleting entities dim 0 failed" );
789  MB_CHK_SET_ERR( m_interface->get_connectivity( sharedents, sharedverts ), "Deleting entities dim 0 failed" );
790  sharedverts = subtract( sharedverts, ownedverts );
791  // MB_CHK_SET_ERR( m_interface->remove_entities(m_overlap_set, sharedents), // "Deleting entities dim 2 failed" ); MB_CHK_SET_ERR( m_interface->remove_entities(m_overlap_set,
792  // sharedverts), "Deleting entities dim 0 failed" );
793 
794  sharedGhostEntities.merge( sharedents );
795  // sharedGhostEntities.merge(sharedverts);
796  }
797 #endif
798  return moab::MB_SUCCESS;
799 }

References moab::Range::clear(), 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  if( initialize_fsets )
56  {
60  }
61  else
62  {
63  m_source_set = 0;
64  m_target_set = 0;
65  m_overlap_set = 0;
66  }
67 
68  is_parallel = false;
69  is_root = true;
70  rank = 0;
71  size = 1;
72 #ifdef MOAB_HAVE_MPI
73  int flagInit;
74  MPI_Initialized( &flagInit );
75  if( flagInit )
76  {
77  assert( m_pcomm != nullptr );
78  rank = m_pcomm->rank();
79  size = m_pcomm->size();
80  is_root = ( rank == 0 );
81  is_parallel = ( size > 1 );
82  // is_parallel = true;
83  }
84  AnnounceOnlyOutputOnRankZero();
85 #endif
86 
87  m_source = nullptr;
88  m_target = nullptr;
89  m_overlap = nullptr;
90  m_covering_source = nullptr;
91 
92  point_cloud_source = false;
93  point_cloud_target = false;
94 
95  return MB_SUCCESS;
96 }

References moab::Interface::create_meshset(), 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 176 of file TempestRemapper.cpp.

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

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 151 of file TempestRemapper.cpp.

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

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 anonymous_namespace{mbtempest.cpp}::handleOverlapMemory(), 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 570 of file TempestRemapper.hpp.

571 {
572  switch( ctx )
573  {
575  delete m_source;
576  m_source = new Mesh;
577  m_source_set = meshSet;
579  m_source->CalculateFaceAreas( false ); // fInputConcave is false ?
580  break;
582  // not needed yet
583  break;
585  // not needed yet
586  break;
588  // not needed yet
589  break;
590  case Remapper::DEFAULT:
591  default:
592  break;
593  }
594 }

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 540 of file TempestRemapper.hpp.

541 {
542  switch( ctx )
543  {
545  if( !overwrite && m_source ) return;
546  if( overwrite && m_source ) delete m_source;
547  m_source = mesh;
548  break;
550  if( !overwrite && m_target ) return;
551  if( overwrite && m_target ) delete m_target;
552  m_target = mesh;
553  break;
555  if( !overwrite && m_overlap ) return;
556  if( overwrite && m_overlap ) delete m_overlap;
557  m_overlap = mesh;
558  break;
560  if( !overwrite && m_covering_source ) return;
561  if( overwrite && m_covering_source ) delete m_covering_source;
562  m_covering_source = mesh;
563  break;
564  case Remapper::DEFAULT:
565  default:
566  break;
567  }
568 }

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 anonymous_namespace{mbtempest.cpp}::convertAndWriteMOABMesh(), and anonymous_namespace{mbtempest.cpp}::handleOverlapMemory().

◆ 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 996 of file TempestRemapper.cpp.

999 {
1000 
1001  if( ctx == Remapper::SourceMesh ) // should not be used
1002  {
1003  m_source_set = mset;
1004  if( entities ) m_source_entities = *entities;
1005  }
1006  else if( ctx == Remapper::TargetMesh )
1007  {
1008  m_target_set = mset;
1009  if( entities ) m_target_entities = *entities;
1010  }
1011  else if( ctx == Remapper::CoveringMesh )
1012  {
1013  m_covering_source_set = mset;
1014  if( entities ) m_covering_source_entities = *entities;
1015  }
1016  else
1017  {
1018  // nothing to do really..
1019  return;
1020  }
1021 }

References moab::Remapper::CoveringMesh, 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 700 of file TempestRemapper.hpp.

701 {
702  switch( ctx )
703  {
705  m_source_type = static_cast< moab::TempestRemapper::TempestMeshType >( metadata[0] );
706  if( metadata[0] == 1 ) // RLL mesh
707  {
708  m_source_metadata.resize( 2 );
709  m_source_metadata[0] = metadata[1];
710  m_source_metadata[1] = metadata[2];
711  }
712  else
713  {
714  m_source_metadata.resize( 1 );
715  m_source_metadata[0] = metadata[1];
716  }
717  break;
719  m_target_type = static_cast< moab::TempestRemapper::TempestMeshType >( metadata[0] );
720  if( metadata[0] == 1 ) // RLL mesh
721  {
722  m_target_metadata.resize( 2 );
723  m_target_metadata[0] = metadata[1];
724  m_target_metadata[1] = metadata[2];
725  }
726  else
727  {
728  m_target_metadata.resize( 1 );
729  m_target_metadata[0] = metadata[1];
730  }
731  break;
734  default:
735  break;
736  }
737 }

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 anonymous_namespace{mbtempest.cpp}::handleOverlapMOAB().

◆ 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 960 of file TempestRemapper.cpp.

964 {
965  // Let us alos write out the TempestRemap equivalent so that we can do some verification checks
966  if( fAllParallel )
967  {
968  if( is_root && size == 1 )
969  {
970  this->m_source->CalculateFaceAreas( fInputConcave );
971  this->m_target->CalculateFaceAreas( fOutputConcave );
972  this->m_overlap->Write( strOutputFileName.c_str(), NcFile::Netcdf4 );
973  }
974  else
975  {
976  // Perform reduction and write from root processor
977  // if ( is_root )
978  // std::cout << "--- PARALLEL IMPLEMENTATION is NOT AVAILABLE yet ---\n";
979 
980  this->m_source->CalculateFaceAreas( fInputConcave );
981  this->m_covering_source->CalculateFaceAreas( fInputConcave );
982  this->m_target->CalculateFaceAreas( fOutputConcave );
983  this->m_overlap->Write( strOutputFileName.c_str(), NcFile::Netcdf4 );
984  }
985  }
986  else
987  {
988  this->m_source->CalculateFaceAreas( fInputConcave );
989  this->m_target->CalculateFaceAreas( fOutputConcave );
990  this->m_overlap->Write( strOutputFileName.c_str(), NcFile::Netcdf4 );
991  }
992 
993  return moab::MB_SUCCESS;
994 }

References MB_SUCCESS.

Friends And Related Function Documentation

◆ TempestOnlineMap

friend class TempestOnlineMap
friend

Definition at line 73 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 390 of file TempestRemapper.hpp.

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

◆ is_parallel

bool moab::TempestRemapper::is_parallel = false
private

◆ is_root

◆ m_area_method

IntxAreaUtils::AreaMethod moab::TempestRemapper::m_area_method = IntxAreaUtils::lHuiller
private

Definition at line 512 of file TempestRemapper.hpp.

◆ m_covering_source

Mesh* moab::TempestRemapper::m_covering_source = nullptr
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 = 0
private

◆ m_covering_source_vertices

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

◆ m_overlap

Mesh* moab::TempestRemapper::m_overlap = nullptr
private

◆ m_overlap_entities

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

◆ m_overlap_set

moab::EntityHandle moab::TempestRemapper::m_overlap_set = 0
private

◆ m_overlap_type

TempestMeshType moab::TempestRemapper::m_overlap_type = DEFAULT
private

Definition at line 494 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 497 of file TempestRemapper.hpp.

◆ m_source

Mesh* moab::TempestRemapper::m_source = nullptr
private

◆ 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 480 of file TempestRemapper.hpp.

Referenced by SetMeshType().

◆ m_source_set

moab::EntityHandle moab::TempestRemapper::m_source_set = 0
private

◆ m_source_type

TempestMeshType moab::TempestRemapper::m_source_type
private

Definition at line 474 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 = nullptr
private

◆ m_target_entities

◆ m_target_metadata

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

Definition at line 490 of file TempestRemapper.hpp.

Referenced by SetMeshType().

◆ m_target_set

moab::EntityHandle moab::TempestRemapper::m_target_set = 0
private

◆ m_target_type

TempestMeshType moab::TempestRemapper::m_target_type
private

Definition at line 484 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 = 0
private

Definition at line 478 of file TempestRemapper.hpp.

Referenced by ConstructCoveringSet().

◆ max_target_edges

int moab::TempestRemapper::max_target_edges = 0
private

Definition at line 488 of file TempestRemapper.hpp.

Referenced by ConstructCoveringSet().

◆ mbintx

moab::Intx2MeshOnSphere* moab::TempestRemapper::mbintx = nullptr
private

Definition at line 500 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 382 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 375 of file TempestRemapper.hpp.

Referenced by convert_mesh_to_tempest_private(), and ConvertOverlapMeshSourceOrdered().

◆ point_cloud_source

bool moab::TempestRemapper::point_cloud_source = false
private

Definition at line 479 of file TempestRemapper.hpp.

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

◆ point_cloud_target

bool moab::TempestRemapper::point_cloud_target = false
private

◆ rank

◆ rrmgrids

bool moab::TempestRemapper::rrmgrids = false
private

Definition at line 514 of file TempestRemapper.hpp.

Referenced by ComputeOverlapMesh(), and ConstructCoveringSet().

◆ size

int moab::TempestRemapper::size = 0
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 398 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: