#include <mesh_data.h>
Public Types | |
typedef std::map< const Node *, std::vector< Number > >::const_iterator | const_node_data_iterator |
typedef std::map< const Elem *, std::vector< Number > >::const_iterator | const_elem_data_iterator |
Public Member Functions | |
MeshData (const MeshBase &m) | |
~MeshData () | |
void | activate (const std::string &descriptor="") |
void | enable_compatibility_mode (const std::string &descriptor="") |
void | clear () |
void | slim (const bool node_id_map=true, const bool elem_id_map=true) |
void | translate (const MeshBase &out_mesh, std::vector< Number > &data_values, std::vector< std::string > &data_names) const |
void | read (const std::string &name) |
void | write (const std::string &name) |
std::string | get_info () const |
void | print_info (std::ostream &os=libMesh::out) const |
Number | operator() (const Node *node, const unsigned int i=0) const |
bool | has_data (const Node *node) const |
const std::vector< Number > & | get_data (const Node *node) const |
void | set_data (const Node *node, const std::vector< Number > &val) |
unsigned int | n_val_per_node () const |
dof_id_type | n_node_data () const |
const_node_data_iterator | node_data_begin () const |
const_node_data_iterator | node_data_end () const |
void | insert_node_data (std::map< const Node *, std::vector< Number > > &nd, const bool close_elem_data=true) |
Number | operator() (const Elem *elem, const unsigned int i=0) const |
bool | has_data (const Elem *elem) const |
const std::vector< Number > & | get_data (const Elem *elem) const |
void | set_data (const Elem *elem, const std::vector< Number > &val) |
unsigned int | n_val_per_elem () const |
dof_id_type | n_elem_data () const |
const_elem_data_iterator | elem_data_begin () const |
const_elem_data_iterator | elem_data_end () const |
void | insert_elem_data (std::map< const Elem *, std::vector< Number > > &ed, const bool close_node_data=true) |
bool | active () const |
bool | compatibility_mode () const |
bool | elem_initialized () const |
bool | node_initialized () const |
const Node * | foreign_id_to_node (const unsigned int fid) const |
const Elem * | foreign_id_to_elem (const unsigned int fid) const |
unsigned int | node_to_foreign_id (const Node *n) const |
unsigned int | elem_to_foreign_id (const Elem *n) const |
const MeshDataUnvHeader & | get_unv_header () const |
void | set_unv_header (MeshDataUnvHeader *unv_header) |
void | assign (const MeshData &omd) |
void | add_foreign_node_id (const Node *node, const unsigned int foreign_node_id) |
void | add_foreign_elem_id (const Elem *elem, const unsigned int foreign_elem_id) |
void | close_foreign_id_maps () |
Protected Member Functions | |
void | read_tetgen (const std::string &name) |
void | read_unv (const std::string &file_name) |
void | read_unv_implementation (std::istream &in_file) |
void | write_unv (const std::string &file_name) |
void | write_unv_implementation (std::ostream &out_file) |
void | read_xdr (const std::string &name, const XdrMODE mode=READ) |
void | write_xdr (const std::string &name, const XdrMODE mode=WRITE) |
Protected Attributes | |
const MeshBase & | _mesh |
std::string | _data_descriptor |
std::map< const Node *, std::vector< Number > > | _node_data |
std::map< const Node *, unsigned int > | _node_id |
std::map< unsigned int, const Node * > | _id_node |
std::map< const Elem *, std::vector< Number > > | _elem_data |
std::map< const Elem *, unsigned int > | _elem_id |
std::map< unsigned int, const Elem * > | _id_elem |
bool | _node_id_map_closed |
bool | _node_data_closed |
bool | _elem_id_map_closed |
bool | _elem_data_closed |
bool | _active |
bool | _compatibility_mode |
MeshDataUnvHeader * | _unv_header |
Friends | |
class | MeshDataUnvHeader |
std::ostream & | operator<< (std::ostream &os, const MeshData &m) |
The MeshData
class handles actual data and the corresponding I/O on entities (nodes, elements) of meshes. The MeshData
can be used when dealing with files that contain nodal or element-oriented data, numbered in the same format as a corresponding mesh file (when activated) or with the libMesh
element and node indices (when in compatibility mode). To use MeshData
, it has to be either activated or the compatibility mode has to be enabled.
Definition at line 54 of file mesh_data.h.
typedef std::map<const Elem *, std::vector<Number> >::const_iterator libMesh::MeshData::const_elem_data_iterator |
A const iterator over the element-associated data entries of MeshData
. Use this when a loop over all Node
* in the MeshData
is wanted. Note that only const versions are provided. Also these iterators should not be confused with the node_iterators
provided for the Mesh
classes!
Definition at line 77 of file mesh_data.h.
typedef std::map<const Node *, std::vector<Number> >::const_iterator libMesh::MeshData::const_node_data_iterator |
A const iterator over the nodal data entries of MeshData
. Use this when a loop over all Node
* in the MeshData
is wanted. Note that only const versions are provided. Also these iterators should not be confused with the node_iterators
provided for the Mesh
classes!
Definition at line 67 of file mesh_data.h.
libMesh::MeshData::MeshData | ( | const MeshBase & | m | ) |
Default Constructor. Takes const reference to the mesh it belongs to.
Definition at line 35 of file mesh_data.C.
libMesh::MeshData::~MeshData | ( | ) |
void libMesh::MeshData::activate | ( | const std::string & | descriptor = "" | ) |
When MeshData
should be used, it has to be activated first, prior to reading in a mesh with the Mesh::read()
methods. This will ensure that element and node ids given in the mesh file, i.e. the foreign node and element ids, are stored in the corresponding id maps. Optionally takes a string that should help the user in identifying the data later on.
Definition at line 64 of file mesh_data.C.
References _active, _compatibility_mode, _data_descriptor, and libMesh::err.
|
inline |
true
when this object is active and working. Use activate()
to bring this object alive. Definition at line 988 of file mesh_data.h.
References _active.
Referenced by libMesh::UNVIO::elements_out(), get_info(), libMesh::UNVIO::nodes_out(), slim(), and libMesh::UNVIO::write_implementation().
|
inline |
In general, MeshData
gathers element-associated data from file, but it needs to relate this data with the Elem
* of the current mesh. Mesh importers simply use this method to add such a map.
Definition at line 1046 of file mesh_data.h.
References _active, _elem_id, _elem_id_map_closed, _id_elem, and libMesh::libmesh_assert().
Referenced by assign(), libMesh::TetGenIO::element_in(), and libMesh::UNVIO::elements_in().
|
inline |
In general, MeshData
gathers nodal data from a file, but it needs to relate this data with the Node
* of the current mesh. Mesh importers simply use this method to add such a map.
Definition at line 1020 of file mesh_data.h.
References _active, _id_node, _node_id, _node_id_map_closed, and libMesh::libmesh_assert().
Referenced by libMesh::TetGenIO::node_in(), and libMesh::UNVIO::nodes_in().
void libMesh::MeshData::assign | ( | const MeshData & | omd | ) |
Assign to this
the data from the other MeshData
. Used by BoundaryInfo
when copying the MeshData
from the d
dimensional mesh to the d-1
dimensional mesh (the boundary mesh).
Definition at line 663 of file mesh_data.C.
References _active, _compatibility_mode, _data_descriptor, _elem_data, _elem_data_closed, _elem_id, _elem_id_map_closed, _id_node, _mesh, _node_data, _node_data_closed, _node_id, _node_id_map_closed, _unv_header, add_foreign_elem_id(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::DofObject::id(), and libMesh::libmesh_assert().
Referenced by libMesh::BoundaryInfo::sync().
void libMesh::MeshData::clear | ( | ) |
Clears the data fields, but leaves the id maps untouched. Useful for clearing data for a new data file. Use slim()
to delete the maps.
Definition at line 109 of file mesh_data.C.
References _data_descriptor, _elem_data, _elem_data_closed, _node_data, and _node_data_closed.
Referenced by read_unv(), read_xdr(), and ~MeshData().
void libMesh::MeshData::close_foreign_id_maps | ( | ) |
Signal to this object that the mesh importer finished adding node and element foreign-id maps.
Definition at line 217 of file mesh_data.C.
References _active, _elem_id, _elem_id_map_closed, _id_elem, _id_node, _node_id, _node_id_map_closed, and libMesh::libmesh_assert().
Referenced by libMesh::UNVIO::read_implementation(), and libMesh::TetGenIO::read_nodes_and_elem().
|
inline |
true
when this object is in compatibility mode. See enable_compatibility_mode()
for details. Definition at line 996 of file mesh_data.h.
References _compatibility_mode.
Referenced by libMesh::UNVIO::elements_out(), get_info(), libMesh::UNVIO::nodes_out(), read(), slim(), write(), and libMesh::UNVIO::write_implementation().
|
inline |
Returns a MeshData::const_elem_data_iterators
which points to the beginning of the Elem
* data containers used here.
Definition at line 970 of file mesh_data.h.
References _elem_data.
|
inline |
Returns a MeshData::const_elem_data_iterators
which points to the end of the Elem
* data containers used here.
Definition at line 978 of file mesh_data.h.
References _elem_data.
|
inline |
true
when this object is properly initialized and ready for use for element associated data, false
otherwise. Definition at line 1004 of file mesh_data.h.
References _active, and _elem_data_closed.
Referenced by get_info().
unsigned int libMesh::MeshData::elem_to_foreign_id | ( | const Elem * | n | ) | const |
Elem
* maps to. Definition at line 463 of file mesh_data.C.
References _active, _compatibility_mode, _elem_id, _elem_id_map_closed, libMesh::DofObject::id(), and libMesh::libmesh_assert().
Referenced by libMesh::UNVIO::elements_out(), and write_xdr().
void libMesh::MeshData::enable_compatibility_mode | ( | const std::string & | descriptor = "" | ) |
When the MeshData
should be used, but was not activated prior to reading in a mesh, then the compatibility mode enables to still use this object as if the MeshData
was active. The foreign node and element ids are simply assigned the indices used in libMesh
. Note that the compatibility mode should be used with caution, since the node and element indices in libMesh
may be renumbered any time. This MeshData
always employs the current node and element ids, it does not create an image of ids when compatibility mode was activated.
Definition at line 81 of file mesh_data.C.
References _active, _compatibility_mode, _data_descriptor, _elem_id, _elem_id_map_closed, _id_elem, _id_node, _node_id, _node_id_map_closed, and libMesh::err.
Referenced by libMesh::UNVIO::write_implementation().
const Elem * libMesh::MeshData::foreign_id_to_elem | ( | const unsigned int | fid | ) | const |
Elem
* that this foreign id maps to. Definition at line 434 of file mesh_data.C.
References _active, _compatibility_mode, _elem_id_map_closed, _id_elem, _mesh, libMesh::MeshBase::elem_ptr(), libMesh::libmesh_assert(), and libmesh_nullptr.
Referenced by read_tetgen(), and read_xdr().
const Node * libMesh::MeshData::foreign_id_to_node | ( | const unsigned int | fid | ) | const |
Node
* that this foreign id maps to. Definition at line 369 of file mesh_data.C.
References _active, _compatibility_mode, _id_node, _mesh, _node_id_map_closed, libMesh::libmesh_assert(), libmesh_nullptr, and libMesh::MeshBase::node_ptr().
Referenced by read_tetgen(), read_unv_implementation(), and read_xdr().
node
. Beware: this method will crash when there is no data associated with the node node!
Check existence through has_data()
first. Definition at line 862 of file mesh_data.h.
References _active, _compatibility_mode, _node_data, _node_data_closed, and libMesh::libmesh_assert().
Referenced by write_unv_implementation(), and write_xdr().
elem
. Beware: this method will crash when there is no data associated with the element elem!
Check existence through has_data()
first. Definition at line 942 of file mesh_data.h.
References _active, _compatibility_mode, _elem_data, _elem_data_closed, and libMesh::libmesh_assert().
std::string libMesh::MeshData::get_info | ( | ) | const |
Definition at line 322 of file mesh_data.C.
References _data_descriptor, active(), compatibility_mode(), elem_initialized(), n_elem_data(), n_node_data(), n_val_per_elem(), n_val_per_node(), and node_initialized().
Referenced by print_info().
|
inline |
Read access to the MeshDataUnvHeader
data structure.
Definition at line 1063 of file mesh_data.h.
References _unv_header, and libMesh::libmesh_assert().
|
inline |
true
when the node node
has data, false
otherwise. Definition at line 848 of file mesh_data.h.
References _active, _compatibility_mode, _node_data, _node_data_closed, and libMesh::libmesh_assert().
Referenced by write_unv_implementation(), and write_xdr().
|
inline |
true
when the element elem
has data, false
otherwise. Definition at line 928 of file mesh_data.h.
References _active, _compatibility_mode, _elem_data, _elem_data_closed, and libMesh::libmesh_assert().
void libMesh::MeshData::insert_elem_data | ( | std::map< const Elem *, std::vector< Number > > & | ed, |
const bool | close_node_data = true |
||
) |
For the desperate user, element-associated boundary conditions may be inserted directly through the map ed
. Similar to the version for nodal data, it is imperative that the local _elem_data
is empty, that the id maps are closed, that the size of the std::vector's
of each map have identical length and that the Elem
points to elements of the associated mesh. Note that this method takes a non-const reference and essentially clears the passed-in data. If close_node_data
is true
(default), then this MeshData
is ready for use: write to file, use the operator() methods etc. If false
, the user has to add nodal data, too.
Definition at line 553 of file mesh_data.C.
References _active, _compatibility_mode, _elem_data, _elem_data_closed, _elem_id_map_closed, _node_data_closed, _node_id_map_closed, and libMesh::libmesh_assert().
void libMesh::MeshData::insert_node_data | ( | std::map< const Node *, std::vector< Number > > & | nd, |
const bool | close_elem_data = true |
||
) |
For the desperate user, nodal boundary conditions may be inserted directly through the map nd
. It is mandatory that there does not yet exist any other node data in this object, that the id maps are closed, that the size of the std::vector's of each map have identical length and that the Node * point to nodes of the associated mesh. Note that this method takes a non-const reference and essentially clears the passed-in data. If close_elem_data
is true
(default), then this MeshData
is ready for use: write to file, use the operator() methods etc. If false
, the user has to add element-associated data, too.
Definition at line 497 of file mesh_data.C.
References _active, _compatibility_mode, _elem_data_closed, _elem_id_map_closed, _node_data, _node_data_closed, _node_id_map_closed, and libMesh::libmesh_assert().
dof_id_type libMesh::MeshData::n_elem_data | ( | ) | const |
MeshData
has data stored. Definition at line 652 of file mesh_data.C.
References _active, _compatibility_mode, _elem_data, _elem_data_closed, and libMesh::libmesh_assert().
Referenced by get_info().
dof_id_type libMesh::MeshData::n_node_data | ( | ) | const |
MeshData
has data stored. Definition at line 622 of file mesh_data.C.
References _active, _compatibility_mode, _node_data, _node_data_closed, and libMesh::libmesh_assert().
Referenced by get_info().
unsigned int libMesh::MeshData::n_val_per_elem | ( | ) | const |
Number
-type data (i.e., the size of the std::vector<Number>
returned through the operator()
methods) associated with an element. Returns 0 when there is no element-associated data. Definition at line 633 of file mesh_data.C.
References _active, _compatibility_mode, _elem_data, _elem_data_closed, and libMesh::libmesh_assert().
Referenced by get_info().
unsigned int libMesh::MeshData::n_val_per_node | ( | ) | const |
Number
-type data (i.e., the size of the std::vector<Number>
returned through the operator()
methods) associated with a node. Returns 0 when no nodal data exists. Definition at line 603 of file mesh_data.C.
References _active, _compatibility_mode, _node_data, _node_data_closed, and libMesh::libmesh_assert().
Referenced by get_info(), translate(), and write_unv_implementation().
|
inline |
Returns the MeshData::const_node_data_iterator
which points to the beginning of the Node
* data containers used here.
Definition at line 890 of file mesh_data.h.
References _node_data.
|
inline |
Returns the MeshData::const_node_data_iterator
which points to the end of the Node
* data containers used here.
Definition at line 898 of file mesh_data.h.
References _node_data.
|
inline |
true
when this object is properly initialized and ready for use for nodal data, false
otherwise. Definition at line 1012 of file mesh_data.h.
References _active, and _node_data_closed.
Referenced by get_info().
unsigned int libMesh::MeshData::node_to_foreign_id | ( | const Node * | n | ) | const |
Node
* maps to. Definition at line 399 of file mesh_data.C.
References _active, _compatibility_mode, _node_id, _node_id_map_closed, libMesh::DofObject::id(), and libMesh::libmesh_assert().
Referenced by libMesh::UNVIO::elements_out(), libMesh::UNVIO::nodes_out(), write_unv_implementation(), and write_xdr().
node
. Returns libMesh::zero
when there is no such node
in the map. Definition at line 828 of file mesh_data.h.
References _active, _compatibility_mode, _node_data, _node_data_closed, libMesh::libmesh_assert(), and libMesh::zero.
elem
. Returns libMesh::zero
when there is no data for elem
in the map. Definition at line 908 of file mesh_data.h.
References _active, _compatibility_mode, _elem_data, _elem_data_closed, libMesh::libmesh_assert(), and libMesh::zero.
void libMesh::MeshData::print_info | ( | std::ostream & | os = libMesh::out | ) | const |
Prints relevant information about the mesh.
Definition at line 353 of file mesh_data.C.
References get_info().
Referenced by libMesh::operator<<().
void libMesh::MeshData::read | ( | const std::string & | name | ) |
Read mesh data from file named name
. Guess format from the file extension. Note that prior to this you have to at least either close_node_map()
or close_elem_map()
.
Definition at line 235 of file mesh_data.C.
References _active, _compatibility_mode, _elem_id_map_closed, _node_id_map_closed, compatibility_mode(), libMesh::DECODE, libMesh::err, libMesh::libmesh_assert(), libMesh::READ, read_tetgen(), read_unv(), and read_xdr().
|
protected |
Read nodal/element oriented data in TetGen format.
Definition at line 34 of file mesh_data_tetgen_support.C.
References _data_descriptor, _elem_data, _elem_data_closed, _node_data, _node_data_closed, foreign_id_to_elem(), foreign_id_to_node(), libMesh::MeshTools::n_elem(), n_nodes, libMesh::Quality::name(), and libMesh::Real.
Referenced by read().
|
protected |
Read nodal/element oriented data in UNV format, either from an ASCII file or from a gzip'ed ASCII file, using the C++ wrapper gzstream
to zlib.h
.
Definition at line 39 of file mesh_data_unv_support.C.
References _active, _compatibility_mode, _elem_id_map_closed, _node_id_map_closed, clear(), libMesh::libmesh_assert(), and read_unv_implementation().
Referenced by read().
|
protected |
Actual implementation of reading nodal/element oriented data in UNV format. This has to be decoupled from read_unv()
in order to allow reading both .unv and
.unv.gz files.
Definition at line 85 of file mesh_data_unv_support.C.
References _elem_data, _elem_data_closed, _node_data, _node_data_closed, _unv_header, libMesh::MeshDataUnvHeader::data_type, libMesh::MeshDataUnvHeader::dataset_location, foreign_id_to_node(), libMesh::libmesh_assert(), libmesh_nullptr, libMesh::MeshDataUnvHeader::need_D_to_e(), libMesh::MeshDataUnvHeader::nvaldc, libMesh::MeshDataUnvHeader::read(), and libMesh::Real.
Referenced by read_unv().
Read nodal/element oriented data using the Xdr
class that enables both ASCII and binary format through the same interface. By default uses ASCII format, but may easily be changed setting mode
to DECODE
.
This code implements the output of the MeshData object in XDR format. This warrants some documentation. The output consists of 8 sections:
1.) The name of the data stored, if provided (string)
2.) A switch whether real or complex data is stored (string)
3.) The number of nodes for which values are stored (unsigned int)
4.) The number of elements for which values are stored (unsigned int)
for each node
5.) The foreign node id (unsigned int)
6.) The actual values (vector of real/complex)
end node loop
for each element
7.) The foreign element id (unsigned int)
8.) The actual values (vector of real/complex)
end node loop
Note that the actual IO is handled through the Xdr class (to be renamed later?) which provides a uniform interface to both the XDR (eXternal Data Representation) interface and standard ASCII output. Thus this one section of code will write XDR or ASCII files with no changes.
clear the data, but keep the id maps
1.)
Read the descriptive name
2.)
Read: either real or complex
3.)
Read the number of nodes for which data is there
4.)
Read the number of elements for which data is there
5.)
Read the foreign node id, locate the Node * associated with this foreign id
6.)
the actual values for this node, Xdr knows the length
insert this node and the values in the _node_data
7.)
Read the foreign elem id, locate the Elem *
8.)
the actual values for this elem, Xdr knows how many
insert this elem and the values in our _elem_data only when we own this element!
Definition at line 35 of file mesh_data_xdr_support.C.
References _active, _compatibility_mode, _data_descriptor, _elem_data, _elem_data_closed, _elem_id_map_closed, _mesh, _node_data, _node_data_closed, _node_id_map_closed, clear(), libMesh::Xdr::data(), foreign_id_to_elem(), foreign_id_to_node(), libMesh::libmesh_assert(), libMesh::MeshTools::n_elem(), libMesh::ParallelObject::processor_id(), and libMesh::DofObject::processor_id().
Referenced by read().
Sets all the data values associated with the node node
, overwriting any existing vector
Definition at line 881 of file mesh_data.h.
References _node_data.
Sets all the data values associated with the element elem
, overwriting any existing vector
Definition at line 961 of file mesh_data.h.
References _elem_data.
|
inline |
Set the MeshDataUnvHeader
data structure that will be used for output.
Definition at line 1071 of file mesh_data.h.
References _unv_header, and libMesh::libmesh_assert().
void libMesh::MeshData::slim | ( | const bool | node_id_map = true , |
const bool | elem_id_map = true |
||
) |
Once the data is properly read from file, the id maps can safely be cleared. However, if this object should remain able to write nodal or element oriented data to file, this method should not be used. Use the appropriate bool
to select the id map that should be cleared. By default, both id maps are deleted.
Definition at line 122 of file mesh_data.C.
References _elem_id, _elem_id_map_closed, _id_elem, _id_node, _node_id, _node_id_map_closed, active(), compatibility_mode(), libMesh::err, and libMesh::libmesh_assert().
void libMesh::MeshData::translate | ( | const MeshBase & | out_mesh, |
std::vector< Number > & | data_values, | ||
std::vector< std::string > & | data_names | ||
) | const |
Translates the nodal data contained in this object to data_values
and data_names
. These two vectors are particularly suitable for use with the MeshBase::write
method that takes nodal data. E.g., the export method may be used for inspecting boundary conditions. A reference to the mesh for which the data should be written has to be provided. Note that this mesh has to contain the nodes for which this MeshData
holds data. I.e., out_mesh
may only refer to the MeshBase
itself (that this MeshData
belongs to), or its BoundaryMesh
, cf. Mesh
.
Definition at line 160 of file mesh_data.C.
References _active, _compatibility_mode, libMesh::libmesh_assert(), libMesh::MeshBase::n_nodes(), n_val_per_node(), libMesh::MeshBase::nodes_begin(), and libMesh::MeshBase::nodes_end().
void libMesh::MeshData::write | ( | const std::string & | name | ) |
Write mesh data to file named name
. Guess format from the file extension.
Definition at line 282 of file mesh_data.C.
References _active, _compatibility_mode, _elem_id_map_closed, _node_id_map_closed, compatibility_mode(), libMesh::ENCODE, libMesh::err, libMesh::libmesh_assert(), libMesh::WRITE, write_unv(), and write_xdr().
|
protected |
Write nodal/element oriented data in UNV format, either to an ASCII file or to a gzip'ed ASCII file, using the C++ wrapper gzstream
to zlib.h
.
Definition at line 382 of file mesh_data_unv_support.C.
References _active, _compatibility_mode, _elem_data_closed, _elem_id_map_closed, _node_data_closed, _node_id_map_closed, libMesh::libmesh_assert(), and write_unv_implementation().
Referenced by write().
|
protected |
Actual implementation of writing nodal/element oriented data in UNV format. This has to be decoupled from write_unv()
in order to allow writing both .unv and
.unv.gz files.
Definition at line 424 of file mesh_data_unv_support.C.
References _elem_data, _node_data, _unv_header, libMesh::MeshDataUnvHeader::data_type, libMesh::err, get_data(), has_data(), libMesh::libmesh_assert(), libmesh_nullptr, n_val_per_node(), node_to_foreign_id(), libMesh::MeshDataUnvHeader::nvaldc, and libMesh::MeshDataUnvHeader::write().
Referenced by write_unv().
|
protected |
Write nodal data in format comparable to the XDR format already known from Mesh
. By default uses ASCII format, but may easily be changed setting mode
to ENCODE
.
This code implements the output of the MeshData object in XDR format. This warrants some documentation. The output consists of 8 sections:
1.) The name of the data stored, if provided (string)
2.) A switch whether real or complex data is stored (string)
3.) The number of nodes for which values are stored (unsigned int)
4.) The number of elements for which values are stored (unsigned int)
for each node
5.) The foreign node id (unsigned int)
6.) The actual values (vector of real/complex)
end node loop
for each element
7.) The foreign element id (unsigned int)
8.) The actual values (vector of real/complex)
end node loop
Note that the actual IO is handled through the Xdr class (to be renamed later?) which provides a uniform interface to both the XDR (eXternal Data Representation) interface and standard ASCII output. Thus this one section of code will write XDR or ASCII files with no changes.
1.)
Write the descriptive name
2.)
Write: either real or complex
3.)
Write the number of nodes for which data is there
4.)
Write the number of elements for which data is there
5.)
Write the foreign node id
6.)
the actual values for this node
7.)
Write the foreign element id
8.)
the actual values for this element
Definition at line 282 of file mesh_data_xdr_support.C.
References _data_descriptor, _elem_data, _elem_data_closed, _elem_id_map_closed, _node_data, _node_data_closed, _node_id_map_closed, libMesh::Xdr::data(), elem_to_foreign_id(), get_data(), has_data(), libMesh::libmesh_assert(), libMesh::MeshTools::n_elem(), and node_to_foreign_id().
Referenced by write().
|
friend |
Make the MeshDataUnvHeader
class a friend.
Definition at line 624 of file mesh_data.h.
|
friend |
Same as above, but allows you to use the stream syntax.
Definition at line 360 of file mesh_data.C.
|
protected |
true
when this object is set active (to gather data during mesh import).
Definition at line 607 of file mesh_data.h.
Referenced by activate(), active(), add_foreign_elem_id(), add_foreign_node_id(), assign(), close_foreign_id_maps(), elem_initialized(), elem_to_foreign_id(), enable_compatibility_mode(), foreign_id_to_elem(), foreign_id_to_node(), get_data(), has_data(), insert_elem_data(), insert_node_data(), n_elem_data(), n_node_data(), n_val_per_elem(), n_val_per_node(), node_initialized(), node_to_foreign_id(), operator()(), read(), read_unv(), read_xdr(), translate(), write(), and write_unv().
|
protected |
true
when this object is in compatibility mode (use libMesh's node and element numbers as fake foreign id's)
Definition at line 614 of file mesh_data.h.
Referenced by activate(), assign(), compatibility_mode(), elem_to_foreign_id(), enable_compatibility_mode(), foreign_id_to_elem(), foreign_id_to_node(), get_data(), has_data(), insert_elem_data(), insert_node_data(), n_elem_data(), n_node_data(), n_val_per_elem(), n_val_per_node(), node_to_foreign_id(), operator()(), read(), read_unv(), read_xdr(), translate(), write(), and write_unv().
|
protected |
Some name the user gave to the data when this object got activated
Definition at line 515 of file mesh_data.h.
Referenced by activate(), assign(), clear(), enable_compatibility_mode(), get_info(), read_tetgen(), read_xdr(), and write_xdr().
Maps element pointers to the element-associated data
Definition at line 549 of file mesh_data.h.
Referenced by assign(), clear(), elem_data_begin(), elem_data_end(), get_data(), has_data(), insert_elem_data(), n_elem_data(), n_val_per_elem(), operator()(), read_tetgen(), read_unv_implementation(), read_xdr(), set_data(), write_unv_implementation(), and write_xdr().
|
protected |
true
when the element based data are properly initialized, false otherwise.
Definition at line 599 of file mesh_data.h.
Referenced by assign(), clear(), elem_initialized(), get_data(), has_data(), insert_elem_data(), insert_node_data(), n_elem_data(), n_val_per_elem(), operator()(), read_tetgen(), read_unv_implementation(), read_xdr(), write_unv(), and write_xdr().
|
protected |
Maps element pointers to element labels in the foreign format.
Definition at line 556 of file mesh_data.h.
Referenced by add_foreign_elem_id(), assign(), close_foreign_id_maps(), elem_to_foreign_id(), enable_compatibility_mode(), and slim().
|
protected |
true
when the mesh importer finished adding element-id maps, and the element-id maps exist. Note that these maps may be deleted through slim()
to save memory. Then the data is still accessible through the Elem
*, but the foreign element id's are lost.
Definition at line 593 of file mesh_data.h.
Referenced by add_foreign_elem_id(), assign(), close_foreign_id_maps(), elem_to_foreign_id(), enable_compatibility_mode(), foreign_id_to_elem(), insert_elem_data(), insert_node_data(), read(), read_unv(), read_xdr(), slim(), write(), write_unv(), and write_xdr().
|
protected |
Maps foreign element labels to element pointers of the current mesh.
Definition at line 562 of file mesh_data.h.
Referenced by add_foreign_elem_id(), close_foreign_id_maps(), enable_compatibility_mode(), foreign_id_to_elem(), and slim().
|
protected |
Maps foreign node ids to node pointers of the current mesh.
Definition at line 539 of file mesh_data.h.
Referenced by add_foreign_node_id(), assign(), close_foreign_id_maps(), enable_compatibility_mode(), foreign_id_to_node(), and slim().
|
protected |
The mesh this object belongs to
Definition at line 509 of file mesh_data.h.
Referenced by assign(), foreign_id_to_elem(), foreign_id_to_node(), and read_xdr().
The map containing pointers to nodes in the mesh and the corresponding data.
Definition at line 525 of file mesh_data.h.
Referenced by assign(), clear(), get_data(), has_data(), insert_node_data(), n_node_data(), n_val_per_node(), node_data_begin(), node_data_end(), operator()(), read_tetgen(), read_unv_implementation(), read_xdr(), set_data(), write_unv_implementation(), and write_xdr().
|
protected |
true
when the nodal data are properly initialized, false otherwise.
Definition at line 581 of file mesh_data.h.
Referenced by assign(), clear(), get_data(), has_data(), insert_elem_data(), insert_node_data(), n_node_data(), n_val_per_node(), node_initialized(), operator()(), read_tetgen(), read_unv_implementation(), read_xdr(), write_unv(), and write_xdr().
|
protected |
Maps node pointers to node numbers in the foreign format.
Definition at line 532 of file mesh_data.h.
Referenced by add_foreign_node_id(), assign(), close_foreign_id_maps(), enable_compatibility_mode(), node_to_foreign_id(), and slim().
|
protected |
true
when the mesh importer finished adding node-foreign-id maps, and the node-foreign-id maps exist. Note that these maps may be deleted through slim()
to save memory. Then the data is still accessible through the Node
* or Elem
*, but the foreign id's are lost.
Definition at line 575 of file mesh_data.h.
Referenced by add_foreign_node_id(), assign(), close_foreign_id_maps(), enable_compatibility_mode(), foreign_id_to_node(), insert_elem_data(), insert_node_data(), node_to_foreign_id(), read(), read_unv(), read_xdr(), slim(), write(), write_unv(), and write_xdr().
|
protected |
The header information of universal files.
Definition at line 619 of file mesh_data.h.
Referenced by assign(), get_unv_header(), read_unv_implementation(), set_unv_header(), and write_unv_implementation().