📄 mesh_data.h
字号:
*/ bool node_initialized () const; //---------------------------------------------------------- // Methods for accessing the node and element maps. // Heavily used by the \p read() and \p write() methods. /** * @returns the \p Node* that this foreign id maps to. */ const Node* foreign_id_to_node (const unsigned int fid) const; /** * @returns the \p Elem* that this foreign id maps to. */ const Elem* foreign_id_to_elem (const unsigned int fid) const; /** * @returns the foreign id this \p Node* maps to. */ unsigned int node_to_foreign_id (const Node* n) const; /** * @returns the foreign id this \p Elem* maps to. */ unsigned int elem_to_foreign_id (const Elem* n) const; //---------------------------------------------------------- // Methods for the header information in universal formated // datasets. /** * Read access to the \p MeshDataUnvHeader data structure. */ const MeshDataUnvHeader & get_unv_header() const; /** * Set the \p MeshDataUnvHeader data structure that will be * used for output. */ void set_unv_header(MeshDataUnvHeader* unv_header); /** * Assign to \p this the data from the other \p MeshData. * Used by \p BoundaryInfo when copying the \p MeshData * from the \p d dimensional mesh to the \p d-1 dimensional mesh * (the boundary mesh). */ void assign (const MeshData& omd); //---------------------------------------------------------- // Methods used by mesh importes to communicate node/element // labels to this \p MeshData /** * In general, \p MeshData gathers nodal data * from a file, but it needs to relate this data * with the \p Node* of the current mesh. Mesh * importers simply use this method to add such * a map. */ void add_foreign_node_id (const Node* node, const unsigned int foreign_node_id); /** * In general, \p MeshData gathers element-associated * data from file, but it needs to relate this data * with the \p Elem* of the current mesh. Mesh * importers simply use this method to add such * a map. */ void add_foreign_elem_id (const Elem* elem, const unsigned int foreign_elem_id); /** * Signal to this object that the mesh importer finished * adding node and element foreign-id maps. */ void close_foreign_id_maps ();protected: //---------------------------------------------------------- // read/write Methods /** * Read nodal/element oriented data in TetGen format. */ void read_tetgen (const std::string& name); /** * Read nodal/element oriented data in UNV format, * either from an ASCII file or from a gzip'ed ASCII * file, using the C++ wrapper \p gzstream to \p zlib.h. */ void read_unv (const std::string& file_name); /** * Actual implementation of reading nodal/element * oriented data in UNV format. This has to be * decoupled from \p read_unv() in order to allow * reading both \p .unv and \p .unv.gz files. */ void read_unv_implementation (std::istream& in_file); /** * Write nodal/element oriented data in UNV format, * either to an ASCII file or to a gzip'ed ASCII * file, using the C++ wrapper \p gzstream to \p zlib.h. */ void write_unv (const std::string& file_name); /** * Actual implementation of writing nodal/element * oriented data in UNV format. This has to be * decoupled from \p write_unv() in order to allow * writing both \p .unv and \p .unv.gz files. */ void write_unv_implementation (std::ostream& out_file); /** * Read nodal/element oriented data using the * \p Xdr class that enables both ASCII and * binary format through the same interface. * By default uses ASCII format, but may easily * be changed setting \p mode to \p DECODE. */ void read_xdr (const std::string& name, const XdrMODE mode = READ); /** * Write nodal data in format comparable to * the XDR format already known from \p Mesh. * By default uses ASCII format, but may easily * be changed setting \p mode to \p ENCODE. */ void write_xdr (const std::string& name, const XdrMODE mode = WRITE); /** * The mesh this object belongs to */ const MeshBase& _mesh; /** * Some name the user gave to the data when this * object got activated */ std::string _data_descriptor; //-------------------------------------------------- // node associated data & maps /** * The map containing pointers to nodes in the mesh * and the corresponding data. */ std::map<const Node*, std::vector<Number> > _node_data; /** * Maps node pointers to node numbers in the @e foreign * format. */ std::map<const Node*, unsigned int> _node_id; /** * Maps @e foreign node ids to node pointers of the * current mesh. */ std::map<unsigned int, const Node*> _id_node; //-------------------------------------------------- // element associated data & maps /** * Maps element pointers to the element-associated data */ std::map<const Elem*, std::vector<Number> > _elem_data; /** * Maps element pointers to element labels in the @e foreign * format. */ std::map<const Elem*, unsigned int> _elem_id; /** * Maps @e foreign element labels to element pointers of the * current mesh. */ std::map<unsigned int, const Elem*> _id_elem; //-------------------------------------------------------- /** * \p 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 * \p slim() to save memory. Then the data is * still accessible through the \p Node* or \p Elem*, * but the foreign id's are lost. */ bool _node_id_map_closed; /** * \p true when the nodal data are properly initialized, * false otherwise. */ bool _node_data_closed; //-------------------------------------------------------- /** * \p true when the mesh importer finished adding * element-id maps, and the element-id maps exist. * Note that these maps may be deleted through * \p slim() to save memory. Then the data is * still accessible through the \p Elem*, * but the foreign element id's are lost. */ bool _elem_id_map_closed; /** * \p true when the element based data are properly initialized, * false otherwise. */ bool _elem_data_closed; //-------------------------------------------------------- /** * \p true when this object is set active (to gather data * during mesh import). */ bool _active; /** * \p true when this object is in compatibility mode * (use libMesh's node and element numbers as fake * foreign id's) */ bool _compatibility_mode; /** * The header information of universal files. */ MeshDataUnvHeader* _unv_header; /** * Make the \p MeshDataUnvHeader class a friend. */ friend class MeshDataUnvHeader; };//-----------------------------------------------------------// MeshDataUnvHeader class definition/** * Class \p MeshDataUnvHeader handles the data specified at * the @e beginning of a dataset 2414 in a universal file. * This header is structured in records 1 to 13. A typical * header is described here. The text after the # are comments * and are @e not part of such a dataset. The text in brackets * after the # are the corresponding class members names. * \verbatim -1 # beginning of dataset 2414 # type of dataset: data at mesh entities 1 # R. 1: unique number of dataset (dataset_label) STRUCTURAL MODE 1 # R. 2: text describing content (dataset_name) 1 # R. 3: data belongs to: nodes, elements,... # (dataset_location) Default Model # R. 4: user-specified text (id_lines_1_to_5[0]) I-DEAS Master Series # R. 5: user-specified text (id_lines_1_to_5[1]) 18-AUG-2003 20:00:12 HPUX11_64 MAR2003 # R. 6: user-specified text (id_lines_1_to_5[2]) MODE 1 FREQUENCY 501.25 Hz # R. 7: user-specified text (id_lines_1_to_5[3]) STRUCTURAL MODE 1 # R. 8: user-specified text (id_lines_1_to_5[4]) 0 2 3 8 2 6 # R. 9: (model_type) (analysis_type) # (data_characteristic) (result_type) # (data_type) (nvaldc) 0 0 0 0 0 1 0 0 # R. 10: analysis-specific data (record_10) 0 0 # R. 11: analysis-specific data (record_11) 0.00000E+00 0.50125E+03 0.99192E+07 0.10000E+01 0.00000E+00 0.00000E+00 # R. 12: analysis-specific data (record_12) 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 # R. 13: analysis-specific data (record_13) \endverbatim * * For more details we refer to the general description of the I-DEAS * universal file format. * * An instance of this class may be attached to the \p MeshData * of some mesh. Then the \p read() and \p write() methods * of \p MeshData use this \p MeshDataUnvHeader instead of * some empty default. Also files that contain multiple * datasets of type \p 2414 may be handled through the * \p which_dataset() method. * Note that an instance of this class has to be attached * to the \p MeshData @e prior to using the \p read() or * \p write() methods of the \p MeshData. */class MeshDataUnvHeader{public: /** * Default Constructor. Initializes the respective * data. */ MeshDataUnvHeader (); /** * Destructor. */ ~MeshDataUnvHeader (); /** * Universal files may contain multiple data sets of type * \p 2414. These sets are identified through their * labels (not to be confused with the dataset label \p 2414!). * The user may provide a label of the dataset that she * wants. Then the file is scanned for this dataset, and * datasets with a different label are skipped. * * When this method is @e not called, then simply the first * dataset in the file is used. Note that for this method * to have any effect, this method has to be called prior to * using the \p MeshData::read() or \p MeshData::write() * methods. */ void which_dataset (const unsigned int ds_label); /** * Assignment operator. Simply assigns all values from \p omduh to \p this. */ void operator = (const MeshDataUnvHeader& omduh); /** * @returns \p true when \p this and \p omduh are equal, * \p false otherwise. */ bool operator == (const MeshDataUnvHeader& omduh) const; /** * Record 1. User specified analysis dataset label. */ unsigned int dataset_label; /** * Record 2. User specified analysis dataset name. */ std::string dataset_name;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -