Example demonstrating direct access to MOAB data for performance optimization. More...
#include "moab/Core.hpp"#include "moab/ProgOptions.hpp"#include "moab/ReadUtilIface.hpp"#include <map>#include <iostream>#include <cassert>
Include dependency graph for DirectAccessNoHoles.cpp:Go to the source code of this file.
Functions | |
| ErrorCode | create_mesh_no_holes (Interface *mbImpl, int nquads) |
| int | main (int argc, char **argv) |
Example demonstrating direct access to MOAB data for performance optimization.
This example shows how to:
The program creates a 1D row of quad elements with contiguous handles, then demonstrates direct access to MOAB's internal data structures for maximum performance when the mesh topology is static.
| [in] | argc | Number of command line arguments |
| [in] | argv | Command line arguments array |
| [in] | -nquads | Number of quads in the mesh (default: 1000) |
Use direct access to MOAB data to avoid calling through API
This example creates a 1d row of quad elements, such that all quad and vertex handles are contiguous in the handle space and in the database. Then it shows how to get access to pointers to MOAB-native data for vertex coordinates, quad connectivity, tag storage, and vertex to quad adjacency lists. This allows applications to access this data directly without going through MOAB's API. In cases where the mesh is not changing (or only mesh vertices are moving), this can save significant execution time in applications.
* ---------------------- * | | | | * | | | | ... * | | | | * ---------------------- *
To compile:
make DirectAccessNoHoles
To run: ./DirectAccessNoHoles [-nquads <# quads>]
Definition in file DirectAccessNoHoles.cpp.
Definition at line 206 of file DirectAccessNoHoles.cpp.
References moab::Range::empty(), moab::Interface::get_adjacencies(), moab::ReadUtilIface::get_element_connect(), moab::ReadUtilIface::get_node_coords(), MB_CHK_SET_ERR, MB_SUCCESS, MBQUAD, and moab::Interface::query_interface().
Referenced by main().
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 83 of file DirectAccessNoHoles.cpp.
References ProgOptions::addOpt(), moab::Interface::adjacencies_iterate(), moab::Range::begin(), moab::Interface::connect_iterate(), moab::Interface::coords_iterate(), create_mesh_no_holes(), moab::Range::end(), moab::Interface::get_entities_by_handle(), MB_CHK_SET_ERR, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_DOUBLE, MB_TYPE_INTEGER, ProgOptions::parseCommandLine(), moab::Range::size(), moab::Range::subset_by_dimension(), moab::Interface::tag_get_handle(), and moab::Interface::tag_iterate().