Nastran BDF mesh input.
The NastranIO class is a preliminary implementation for reading NASTRAN mesh information using pyNastran with BDF data as input. Note that this class is not designed to be a complete Nastran BDF reader with solution & case control, but rather a way to get basic mesh data defined in BDF format into libMesh/MAST. We define basic mesh data as:
TODO: Unit tests for NastranIO class.
Definition at line 62 of file nastran_io.h.
#include <nastran_io.h>
Public Member Functions | |
NastranIO (libMesh::MeshBase &mesh, const bool python_preinit=false) | |
Constructor. More... | |
virtual | ~NastranIO () |
Destructor. More... | |
std::map< libMesh::Elem *, uint64_t > | get_libmesh_to_nastran_elem_map () |
Returns mapping between libMesh/MAST elements and Nastran BDF element ID's. More... | |
std::map< const libMesh::Node *, uint64_t > | get_libmesh_to_nastran_node_map () |
Returns mapping between libMesh/MAST nodes and Nastran BDF grid ID's. More... | |
std::map< std::pair< int, int >, int > | get_nastran_pid_elemtype_to_libmesh_subdomain_map () |
Provides mapping between Nastran property ID & element-type pairs and corresponding libMesh/MAST subdomain ID's. More... | |
std::map< int, std::set< int > > | get_nastran_property_to_libmesh_subdomains_map () |
Returns mapping between Nastran property ID's and sets of libMesh/MAST subdomains. More... | |
std::map< uint64_t, libMesh::Elem * > | get_nastran_to_libmesh_elem_map () |
Returns mapping between Nastran BDF element ID's and libMesh/MAST elements. More... | |
std::map< uint64_t, libMesh::Node * > | get_nastran_to_libmesh_node_map () |
Returns mapping between Nastran BDF grid ID's and libMesh/MAST nodes. More... | |
void | print_pid_to_subdomain_id_map () |
Print map between Nastran property ID's (PID) to libMesh subdomain ID's (SID) to libMesh::out. More... | |
virtual void | read (const std::string &filename) override |
Read ASCII NASTRAN BDF given by filename. More... | |
virtual void | read (BDFModel *model) |
Read data directly from BDFModel object. More... | |
Private Member Functions | |
void | finalize_python () |
void | initialize_python () |
void | read_elements (BDFModel *model, libMesh::MeshBase &the_mesh) |
void | read_node_boundaries (BDFModel *model, libMesh::MeshBase &the_mesh) |
void | read_nodes (BDFModel *model, libMesh::MeshBase &the_mesh) |
Private Attributes | |
std::map< libMesh::Elem *, uint64_t > | libmesh_to_nastran_elem_map |
Mapping from libMesh/MAST element pointers to Nastran element IDs from BDF input. More... | |
std::map< const libMesh::Node *, uint64_t > | libmesh_to_nastran_node_map |
Mapping from libMesh/MAST node pointers to Nastran grid IDs from BDF input. More... | |
std::map< std::pair< int, int >, int > | nastran_pid_elemtype_to_libmesh_subdomain_map = {} |
Mapping from Nastran property ID/element-type pair to libMesh/MAST subdomain. More... | |
std::map< uint64_t, libMesh::Elem * > | nastran_to_libmesh_elem_map |
Mapping from Nastran element IDs from BDF input to pointers to libMesh/MAST elements. More... | |
std::map< std::string, libMesh::ElemType > | nastran_to_libmesh_elem_type_map |
Map from Nastran elements to equivalent libMesh/MAST element types. More... | |
std::map< uint64_t, libMesh::Node * > | nastran_to_libmesh_node_map |
Mapping from Nastran grid IDs from BDF input to pointers to libMesh/MAST nodes. More... | |
bool | python_initialized = false |
Indicates is Python has been initialized. More... | |
const bool | python_preinitialized = false |
Indicates if Python was initialized outside of NastranIO class. More... | |
|
explicit |
Constructor.
mesh | a libMesh mesh object. |
python_preinit | bool describing if Python has been already initialized somewhere in the current program (by another C++/Python interface). |
Definition at line 41 of file nastran_io.cpp.
|
virtual |
Destructor.
Definition at line 53 of file nastran_io.cpp.
|
private |
Definition at line 285 of file nastran_io.cpp.
std::map< libMesh::Elem *, uint64_t > MAST::NastranIO::get_libmesh_to_nastran_elem_map | ( | ) |
Returns mapping between libMesh/MAST elements and Nastran BDF element ID's.
Definition at line 80 of file nastran_io.cpp.
std::map< const libMesh::Node *, uint64_t > MAST::NastranIO::get_libmesh_to_nastran_node_map | ( | ) |
Returns mapping between libMesh/MAST nodes and Nastran BDF grid ID's.
Definition at line 68 of file nastran_io.cpp.
std::map< std::pair< int, int >, int > MAST::NastranIO::get_nastran_pid_elemtype_to_libmesh_subdomain_map | ( | ) |
Provides mapping between Nastran property ID & element-type pairs and corresponding libMesh/MAST subdomain ID's.
Note we must use a pair combining a Nastran property ID along with a specific element type to get a unique map key to libMesh/MAST subdomains. This is because Nastran allows one property ID to be assigned to elements of different type (ie. PSHELL to both CQUAD4 & CTRIA3), but libMesh does not allow elements of different type to belong to the same subdomain.
Definition at line 100 of file nastran_io.cpp.
std::map< int, std::set< int > > MAST::NastranIO::get_nastran_property_to_libmesh_subdomains_map | ( | ) |
Returns mapping between Nastran property ID's and sets of libMesh/MAST subdomains.
Note that one Nastran property ID can map to multiple libMesh/MAST subdomains because Nastran allows one property ID to be assigned to elements of different type (ie. PSHELL to both CQUAD4 & CTRIA3), but libMesh does not allow elements of different type to belong to the same subdomain. In this case, we use multiple subdomains to contain the different element types.
Definition at line 86 of file nastran_io.cpp.
std::map< uint64_t, libMesh::Elem * > MAST::NastranIO::get_nastran_to_libmesh_elem_map | ( | ) |
Returns mapping between Nastran BDF element ID's and libMesh/MAST elements.
Definition at line 74 of file nastran_io.cpp.
std::map< uint64_t, libMesh::Node * > MAST::NastranIO::get_nastran_to_libmesh_node_map | ( | ) |
Returns mapping between Nastran BDF grid ID's and libMesh/MAST nodes.
Definition at line 62 of file nastran_io.cpp.
|
private |
Definition at line 264 of file nastran_io.cpp.
void MAST::NastranIO::print_pid_to_subdomain_id_map | ( | ) |
Print map between Nastran property ID's (PID) to libMesh subdomain ID's (SID) to libMesh::out.
Note that some PID will correspond to multiple SID since libMesh requires all elements in a subdomain to be the same type, but Nastran allows property assignment to multiple element types from the same property card (ie. PSHELL to both CQUAD4 and CTRIA3).
Definition at line 292 of file nastran_io.cpp.
|
overridevirtual |
Read ASCII NASTRAN BDF given by filename.
filename | string path to Nastran BDF formatted file. |
Definition at line 217 of file nastran_io.cpp.
|
virtual |
Read data directly from BDFModel object.
model | pointer to BDFModel object. |
Definition at line 245 of file nastran_io.cpp.
|
private |
Definition at line 128 of file nastran_io.cpp.
|
private |
Definition at line 199 of file nastran_io.cpp.
|
private |
Definition at line 105 of file nastran_io.cpp.
|
private |
Mapping from libMesh/MAST element pointers to Nastran element IDs from BDF input.
Definition at line 163 of file nastran_io.h.
|
private |
Mapping from libMesh/MAST node pointers to Nastran grid IDs from BDF input.
Definition at line 159 of file nastran_io.h.
|
private |
Mapping from Nastran property ID/element-type pair to libMesh/MAST subdomain.
Note we must use a pair combining a Nastran property ID along with a specific element type to get a unique map key to libMesh/MAST subdomains. This is because Nastran allows one property ID to be assigned to elements of different type (ie. PSHELL to both CQUAD4 and CTRIA3), but libMesh does not allow elements of different type to belong to the same subdomain. In this case, we use multiple subdomains to contain the different element types and store this mapping for reference.
Definition at line 175 of file nastran_io.h.
|
private |
Mapping from Nastran element IDs from BDF input to pointers to libMesh/MAST elements.
Definition at line 161 of file nastran_io.h.
|
private |
Map from Nastran elements to equivalent libMesh/MAST element types.
TODO: Not yet complete, need to add all Nastran elements we need support for.
Definition at line 185 of file nastran_io.h.
|
private |
Mapping from Nastran grid IDs from BDF input to pointers to libMesh/MAST nodes.
Definition at line 157 of file nastran_io.h.
|
private |
Indicates is Python has been initialized.
Definition at line 154 of file nastran_io.h.
|
private |
Indicates if Python was initialized outside of NastranIO class.
Definition at line 152 of file nastran_io.h.