111 std::string desc =
"";
124 std::string vtype=
"";
126 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
127 if (vtype !=
"COMPLEX")
128 libmesh_error_msg(
"ERROR: File does not contain complex-valued data!");
130 #elif LIBMESH_USE_REAL_NUMBERS
132 libmesh_error_msg(
"ERROR: File does not contain real-valued data!");
138 libmesh_error_msg(
"Must be using either real or complex numbers!");
149 unsigned int n_node = 0;
162 std::size_t previous_values_size = 0;
165 for (
unsigned int n_cnt=0; n_cnt < n_node; n_cnt++)
173 unsigned int f_id = 0;
186 std::vector<Number> values;
196 previous_values_size = values.size();
199 if (previous_values_size != values.size())
200 libmesh_error_msg(
"ERROR: Size mismatch for n_cnt = " << n_cnt);
208 _node_data.insert (std::make_pair(node, values));
215 previous_values_size = 0;
218 for (
unsigned int n_cnt=0; n_cnt <
n_elem; n_cnt++)
225 unsigned int f_id = 0;
238 std::vector<Number> values;
248 previous_values_size = values.size();
251 if (previous_values_size != values.size())
252 libmesh_error_msg(
"ERROR: Size mismatch for n_cnt = " << n_cnt);
262 _elem_data.insert (std::make_pair(elem, values));
347 io.
data (desc,
"# Data description");
358 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
359 std::string desc =
"COMPLEX";
360 #elif LIBMESH_USE_REAL_NUMBERS
361 std::string desc =
"REAL";
363 better_you_choke_this...
365 io.
data (desc,
"# type of values");
376 unsigned int n_node =
377 cast_int<unsigned int>(this->
_node_data.size());
378 io.
data (n_node,
"# No. of nodes for which data is stored");
389 cast_int<unsigned int>(this->
_elem_data.size());
390 io.
data (n_elem,
"# No. of elements for which data is stored");
396 std::map<
const Node *,
397 std::vector<Number> >::const_iterator nit =
_node_data.begin ();
401 const Node * node = (*nit).first;
410 io.
data (f_id,
"# Foreign node id");
426 const std::vector<Number> & values = this->
get_data(node);
433 std::vector<Number> buf = values;
434 io.
data (buf,
"# Values");
444 std::map<
const Elem *,
445 std::vector<Number> >::const_iterator eit =
_elem_data.begin ();
449 const Elem * elem = (*eit).first;
458 io.
data (f_id,
"# Foreign element id");
474 const std::vector<Number> & values = this->
get_data(elem);
481 std::vector<Number> buf = values;
482 io.
data (buf,
"# Values");
std::string name(const ElemQuality q)
void data(T &a, const char *comment="")
const std::vector< Number > & get_data(const Node *node) const
A geometric point in (x,y,z) space associated with a DOF.
bool has_data(const Node *node) const
libmesh_assert(remote_elem)
The base class for all geometric element types.
void write_xdr(const std::string &name, const XdrMODE mode=WRITE)
unsigned int node_to_foreign_id(const Node *n) const
const Elem * foreign_id_to_elem(const unsigned int fid) const
void read_xdr(const std::string &name, const XdrMODE mode=READ)
std::string _data_descriptor
C++ interface for the XDR (eXternal Data Representation) format.
unsigned int elem_to_foreign_id(const Elem *n) const
const Node * foreign_id_to_node(const unsigned int fid) const
std::map< const Node *, std::vector< Number > > _node_data
std::map< const Elem *, std::vector< Number > > _elem_data
processor_id_type processor_id() const
processor_id_type processor_id() const