The RunttimeContext is an example specific class to store the run specific input data, MOAB datastructures used during the run and provides other utility functions to profile operations etc. More...
Public Member Functions | |
RuntimeContext (MPI_Comm comm=MPI_COMM_WORLD) | |
Constructor: allocate MOAB interface and communicator, and initialize other data members with some default values. More... | |
~RuntimeContext () | |
Destructor: deallocate MOAB interface and communicator. More... | |
void | ParseCLOptions (int argc, char *argv[]) |
Parse the runtime command line options. More... | |
void | timer_push (const std::string &operation) |
Measure and start the timer to profile a task. More... | |
void | timer_pop (const int nruns=1) |
Stop the timer and store the elapsed duration. More... | |
double | last_elapsed () const |
Return the last elapsed time. More... | |
moab::ErrorCode | load_file (bool load_ghosts=false) |
Load a MOAB supported file (h5m or nc format) from disk representing an MPAS mesh. More... | |
moab::ErrorCode | create_sv_tags (moab::Tag &tagScalar, moab::Tag &tagVector, moab::Range &entities) |
Create scalar and vector tags in the MOAB mesh instance. More... | |
double | evaluate_function (double lon, double lat, int type=1, double multiplier=1.0) const |
Evaluate some closed-form Spherical Harmonic functions with an optional multiplier term. More... | |
Public Attributes | |
int | dimension { 2 } |
std::string | input_filename |
dimension of the problem More... | |
std::string | output_filename |
input file name (nc format) More... | |
int | ghost_layers { 3 } |
output file name (h5m format) More... | |
std::string | scalar_tagname |
number of ghost layers More... | |
std::string | vector_tagname |
scalar tag name More... | |
int | vector_length { 3 } |
vector tag name More... | |
int | num_max_exchange { 10 } |
length of the vector tag components More... | |
bool | debug_output { false } |
total number of exchange iterations More... | |
int | proc_id { 1 } |
write debug output information? More... | |
int | num_procs { 1 } |
process identifier More... | |
double | last_counter { 0.0 } |
total number of processes More... | |
moab::Core | moab_interface |
last time counter between push/pop timer More... | |
moab::ParallelComm * | parallel_communicator |
moab::EntityHandle | fileset { 0 } |
moab::EntityHandle | partnset { 0 } |
Private Member Functions | |
std::vector< double > | compute_centroids (const moab::Range &entities) const |
Compute the centroids of elements in 2D lat/lon space. More... | |
Private Attributes | |
moab::CpuTimer | mTimer |
double | mTimerOps { 0.0 } |
std::string | mOpName |
The RunttimeContext is an example specific class to store the run specific input data, MOAB datastructures used during the run and provides other utility functions to profile operations etc.
Definition at line 77 of file ExchangeHalos.cpp.
|
explicit |
Constructor: allocate MOAB interface and communicator, and initialize other data members with some default values.
Implementation details ///.
Definition at line 331 of file ExchangeHalos.cpp.
References moab::Core::create_meshset(), fileset, moab::ParallelComm::get_pcomm(), MESHSET_SET, moab_interface, num_procs, parallel_communicator, partnset, proc_id, moab::ParallelComm::rank(), runchk_cont, and moab::ParallelComm::size().
RuntimeContext::~RuntimeContext | ( | ) |
Destructor: deallocate MOAB interface and communicator.
Definition at line 347 of file ExchangeHalos.cpp.
References parallel_communicator.
|
private |
Compute the centroids of elements in 2D lat/lon space.
entities | Entities to compute centroids |
Definition at line 506 of file ExchangeHalos.cpp.
References entities, moab::Core::get_coords(), moab_interface, and runchk_cont.
Referenced by create_sv_tags().
moab::ErrorCode RuntimeContext::create_sv_tags | ( | moab::Tag & | tagScalar, |
moab::Tag & | tagVector, | ||
moab::Range & | entities | ||
) |
Create scalar and vector tags in the MOAB mesh instance.
tagScalar | Tag reference to the scalar field |
tagVector | Tag reference to the vector field |
entities | Entities on which both the scalar and vector fields are defined |
Definition at line 408 of file ExchangeHalos.cpp.
References compute_centroids(), entities, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_DOUBLE, moab_interface, proc_id, runchk, scalar_tagname, moab::Core::tag_get_handle(), moab::Core::tag_set_data(), vector_length, and vector_tagname.
|
inline |
Evaluate some closed-form Spherical Harmonic functions with an optional multiplier term.
lon | Longitude in lat-lon space |
lat | Latitude in lat-lon space |
type | Function type |
multiplier | Optional multiplier to scale value (default=1.0) |
Definition at line 142 of file ExchangeHalos.cpp.
|
inline |
Return the last elapsed time.
Definition at line 403 of file ExchangeHalos.cpp.
References last_counter.
moab::ErrorCode RuntimeContext::load_file | ( | bool | load_ghosts = false | ) |
Load a MOAB supported file (h5m or nc format) from disk representing an MPAS mesh.
load_ghosts | Optional boolean to specify whether to load ghosts when reading the file (only relevant for h5m) |
Parallel Read options: PARALLEL = type {READ_PART} : Read on all tasks PARTITION_METHOD = RCBZOLTAN : Use Zoltan partitioner to compute an online partition and redistribute on the fly PARTITION = PARALLEL_PARTITION : Partition as you read based on part information stored in h5m file PARALLEL_RESOLVE_SHARED_ENTS : Communicate to all processors to get the shared adjacencies consistently in parallel PARALLEL_GHOSTS : a.b.c : a = 2 - highest dimension of entities (2D in this case) : b = 1 - dimension of entities to calculate adjacencies (vertex=0, edges=1) : c = 3 - number of ghost layers needed (3 in this case)
Definition at line 467 of file ExchangeHalos.cpp.
References fileset, ghost_layers, input_filename, moab::Core::load_file(), MB_UNSUPPORTED_OPERATION, moab_interface, and num_procs.
void RuntimeContext::ParseCLOptions | ( | int | argc, |
char * | argv[] | ||
) |
Parse the runtime command line options.
argc | - number of command line arguments |
argv | - command line arguments as string list |
Definition at line 352 of file ExchangeHalos.cpp.
References ProgOptions::addOpt(), debug_output, ghost_layers, input_filename, num_max_exchange, output_filename, ProgOptions::parseCommandLine(), and vector_length.
void RuntimeContext::timer_pop | ( | const int | nruns = 1 | ) |
Stop the timer and store the elapsed duration.
nruns | Optional argument used to average the measured time |
Definition at line 381 of file ExchangeHalos.cpp.
References moab::ParallelComm::comm(), last_counter, mOpName, mTimer, mTimerOps, num_procs, parallel_communicator, proc_id, and moab::CpuTimer::time_since_birth().
|
inline |
Measure and start the timer to profile a task.
operation | String name of the task being measured |
Definition at line 375 of file ExchangeHalos.cpp.
References mOpName, mTimer, mTimerOps, and moab::CpuTimer::time_since_birth().
bool RuntimeContext::debug_output { false } |
total number of exchange iterations
Definition at line 88 of file ExchangeHalos.cpp.
Referenced by ParseCLOptions().
int RuntimeContext::dimension { 2 } |
Definition at line 80 of file ExchangeHalos.cpp.
moab::EntityHandle RuntimeContext::fileset { 0 } |
Definition at line 96 of file ExchangeHalos.cpp.
Referenced by load_file(), and RuntimeContext().
int RuntimeContext::ghost_layers { 3 } |
output file name (h5m format)
Definition at line 83 of file ExchangeHalos.cpp.
Referenced by load_file(), and ParseCLOptions().
std::string RuntimeContext::input_filename |
dimension of the problem
Definition at line 81 of file ExchangeHalos.cpp.
Referenced by load_file(), and ParseCLOptions().
double RuntimeContext::last_counter { 0.0 } |
total number of processes
Definition at line 91 of file ExchangeHalos.cpp.
Referenced by last_elapsed(), and timer_pop().
moab::Core RuntimeContext::moab_interface |
last time counter between push/pop timer
Definition at line 94 of file ExchangeHalos.cpp.
Referenced by compute_centroids(), create_sv_tags(), load_file(), and RuntimeContext().
|
private |
Definition at line 161 of file ExchangeHalos.cpp.
Referenced by timer_pop(), and timer_push().
|
private |
Definition at line 159 of file ExchangeHalos.cpp.
Referenced by timer_pop(), and timer_push().
|
private |
Definition at line 160 of file ExchangeHalos.cpp.
Referenced by timer_pop(), and timer_push().
int RuntimeContext::num_max_exchange { 10 } |
length of the vector tag components
Definition at line 87 of file ExchangeHalos.cpp.
Referenced by ParseCLOptions().
int RuntimeContext::num_procs { 1 } |
process identifier
Definition at line 90 of file ExchangeHalos.cpp.
Referenced by load_file(), RuntimeContext(), and timer_pop().
std::string RuntimeContext::output_filename |
input file name (nc format)
Definition at line 82 of file ExchangeHalos.cpp.
Referenced by ParseCLOptions().
moab::ParallelComm* RuntimeContext::parallel_communicator |
Definition at line 95 of file ExchangeHalos.cpp.
Referenced by RuntimeContext(), timer_pop(), and ~RuntimeContext().
moab::EntityHandle RuntimeContext::partnset { 0 } |
Definition at line 96 of file ExchangeHalos.cpp.
Referenced by RuntimeContext().
int RuntimeContext::proc_id { 1 } |
write debug output information?
Definition at line 89 of file ExchangeHalos.cpp.
Referenced by create_sv_tags(), RuntimeContext(), and timer_pop().
std::string RuntimeContext::scalar_tagname |
number of ghost layers
Definition at line 84 of file ExchangeHalos.cpp.
Referenced by create_sv_tags().
int RuntimeContext::vector_length { 3 } |
vector tag name
Definition at line 86 of file ExchangeHalos.cpp.
Referenced by create_sv_tags(), and ParseCLOptions().
std::string RuntimeContext::vector_tagname |