The representation of a FemMesh. More...
#include <FemMesh.h>
Classes | |
struct | FemMeshInfo |
Public Member Functions | |
void | addHypothesis (const TopoDS_Shape &aSubShape, SMESH_HypothesisPtr hyp) |
void | compute () |
FemMesh () | |
FemMesh (const FemMesh &) | |
virtual unsigned int | getMemSize (void) const |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? More... | |
SMESH_Mesh * | getSMesh () |
const SMESH_Mesh * | getSMesh () const |
FemMesh & | operator= (const FemMesh &) |
virtual void | Restore (Base::XMLReader &) |
This method is used to restore properties from an XML document. More... | |
void | RestoreDocFile (Base::Reader &reader) |
This method is used to restore large amounts of data from a file In this method you simply stream in your SaveDocFile() saved data. More... | |
virtual void | Save (Base::Writer &) const |
This method is used to save properties to an XML document. More... | |
void | SaveDocFile (Base::Writer &writer) const |
This method is used to save large amounts of data to a binary file. More... | |
void | setStandardHypotheses () |
~FemMesh () | |
Subelement management | |
virtual std::vector< const char * > | getElementTypes (void) const |
Sub type list List of different subelement types it is NOT a list of the subelements itself. More... | |
virtual unsigned long | countSubElements (const char *Type) const |
virtual Data::Segment * | getSubElement (const char *Type, unsigned long) const |
get the subelement by type and number More... | |
search and retrieval | |
std::set< long > | getSurfaceNodes (long ElemId, short FaceId, float Angle=360) const |
retrieving by region growing More... | |
std::set< int > | getNodesBySolid (const TopoDS_Solid &solid) const |
retrieving by solid More... | |
std::set< int > | getNodesByFace (const TopoDS_Face &face) const |
retrieving by face More... | |
std::set< int > | getNodesByEdge (const TopoDS_Edge &edge) const |
retrieving by edge More... | |
std::set< int > | getNodesByVertex (const TopoDS_Vertex &vertex) const |
retrieving by vertex More... | |
std::list< int > | getElementNodes (int id) const |
retrieving node IDs by element ID More... | |
std::list< int > | getFacesByFace (const TopoDS_Face &face) const |
retrieving face IDs number by face More... | |
std::list< int > | getEdgesByEdge (const TopoDS_Edge &edge) const |
retrieving edge IDs number by edge More... | |
std::list< std::pair< int, int > > | getVolumesByFace (const TopoDS_Face &face) const |
retrieving volume IDs and face IDs number by face More... | |
std::map< int, int > | getccxVolumesByFace (const TopoDS_Face &face) const |
retrieving volume IDs and CalculiX face number by face More... | |
std::set< int > | getEdgesOnly (void) const |
retrieving IDs of edges not belonging to any face (and thus not belonging to any volume too) More... | |
std::set< int > | getFacesOnly (void) const |
retrieving IDs of faces not belonging to any volume More... | |
Placement control | |
void | setTransform (const Base::Matrix4D &rclTrf) |
set the transformation More... | |
Base::Matrix4D | getTransform (void) const |
get the transformation More... | |
Base::BoundBox3d | getBoundBox (void) const |
Bound box from the shape. More... | |
Base::Quantity | getVolume (void) const |
get the volume (when there are volume elements) More... | |
Modification | |
void | transformGeometry (const Base::Matrix4D &rclMat) |
Applies a transformation on the real geometric data type. More... | |
Public Member Functions inherited from Data::ComplexGeoData | |
ComplexGeoData () | |
Constructor. More... | |
virtual | ~ComplexGeoData () |
Destructor. More... | |
virtual Segment * | getSubElementByName (const char *Name) const |
get subelement by combined name More... | |
virtual void | getLinesFromSubElement (const Segment *, std::vector< Base::Vector3d > &Points, std::vector< Line > &lines) const |
Get lines from segment. More... | |
virtual void | getFacesFromSubElement (const Segment *, std::vector< Base::Vector3d > &Points, std::vector< Base::Vector3d > &PointNormals, std::vector< Facet > &faces) const |
Get faces from segment. More... | |
void | applyTransform (const Base::Matrix4D &rclTrf) |
Applies an additional transformation to the current transformation. More... | |
void | applyTranslation (const Base::Vector3d &) |
Applies an additional translation to the current transformation. More... | |
void | applyRotation (const Base::Rotation &) |
Applies an additional rotation to the current transformation. More... | |
void | setPlacement (const Base::Placement &rclPlacement) |
Override the current transformation with a placement using the setTransform() method. More... | |
Base::Placement | getPlacement () const |
Return the current transformation as placement using getTransform(). More... | |
virtual Base::Vector3d | getPointFromLineIntersection (const Base::Vector3f &base, const Base::Vector3f &dir) const |
Get point from line object intersection More... | |
virtual void | getPoints (std::vector< Base::Vector3d > &Points, std::vector< Base::Vector3d > &Normals, float Accuracy, uint16_t flags=0) const |
Get points from object with given accuracy. More... | |
virtual void | getLines (std::vector< Base::Vector3d > &Points, std::vector< Line > &lines, float Accuracy, uint16_t flags=0) const |
Get lines from object with given accuracy. More... | |
virtual void | getFaces (std::vector< Base::Vector3d > &Points, std::vector< Facet > &faces, float Accuracy, uint16_t flags=0) const |
Get faces from object with given accuracy. More... | |
virtual bool | getCenterOfGravity (Base::Vector3d ¢er) const |
Get the center of gravity If this method is implemented then true is returned and the center of gravity. More... | |
Public Member Functions inherited from Base::Persistence | |
void | dumpToStream (std::ostream &stream, int compression) |
virtual unsigned int | getMemSize () const =0 |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? More... | |
virtual Base::Type | getTypeId (void) const |
virtual void | Restore (XMLReader &)=0 |
This method is used to restore properties from an XML document. More... | |
virtual void | RestoreDocFile (Reader &) |
This method is used to restore large amounts of data from a file In this method you simply stream in your SaveDocFile() saved data. More... | |
void | restoreFromStream (std::istream &stream) |
virtual void | Save (Writer &) const =0 |
This method is used to save properties to an XML document. More... | |
virtual void | SaveDocFile (Writer &) const |
This method is used to save large amounts of data to a binary file. More... | |
Public Member Functions inherited from Base::BaseClass | |
BaseClass () | |
Construction. More... | |
BaseClass (const BaseClass &)=default | |
virtual PyObject * | getPyObject () |
This method returns the Python wrapper for a C++ object. More... | |
virtual Type | getTypeId () const |
bool | isDerivedFrom (const Type type) const |
BaseClass & | operator= (const BaseClass &)=default |
virtual void | setPyObject (PyObject *) |
virtual | ~BaseClass () |
Destruction. More... | |
Public Member Functions inherited from Base::Handled | |
int | getRefCount () const |
Handled () | |
const Handled & | operator= (const Handled &) |
void | ref () const |
void | unref () const |
virtual | ~Handled () |
Static Public Member Functions | |
static SMESH_Gen * | getGenerator () |
Static Public Member Functions inherited from Data::ComplexGeoData | |
static const std::string & | elementMapPrefix () |
Special prefix to mark the beginning of a mapped sub-element name. More... | |
static const std::string & | tagPostfix () |
Special postfix to mark the following tag. More... | |
static const std::string & | indexPostfix () |
Special postfix to mark the index of an array element. More... | |
static const std::string & | missingPrefix () |
Special prefix to mark a missing element. More... | |
static bool | hasMissingElement (const char *subname) |
Check if a subname contains missing element. More... | |
static const char * | isMappedElement (const char *name) |
Check if the name starts with elementMapPrefix() More... | |
static std::string | newElementName (const char *name) |
Strip out the trailing element name if there is mapped element name precedes it. More... | |
static std::string | oldElementName (const char *name) |
Strip out the mapped element name if there is one. More... | |
static std::string | noElementName (const char *name) |
Strip out the old and new element name if there is one. More... | |
static const char * | findElementName (const char *subname) |
Find the start of an element name in a subname. More... | |
static const char * | hasMappedElementName (const char *subname) |
Static Public Member Functions inherited from Base::Persistence | |
static void * | create (void) |
static std::string | encodeAttribute (const std::string &) |
Encodes an attribute upon saving. More... | |
static Base::Type | getClassTypeId (void) |
static void | init (void) |
Static Public Member Functions inherited from Base::BaseClass | |
static void * | create () |
static Type | getClassTypeId () |
static void | init () |
Group management | |
int | addGroup (const std::string, const std::string, const int=-1) |
Adds group to mesh. More... | |
void | addGroupElements (int, const std::set< int > &) |
Adds elements to group (int due to int used by raw SMESH functions) More... | |
bool | removeGroup (int) |
Remove group (Name due to similarity to SMESH basis functions) More... | |
struct FemMeshInfo | getInfo (void) const |
void | read (const char *FileName) |
import from files More... | |
void | write (const char *FileName) const |
void | writeABAQUS (const std::string &Filename, int elemParam, bool groupParam) const |
void | writeZ88 (const std::string &FileName) const |
Additional Inherited Members | |
Public Attributes inherited from Data::ComplexGeoData | |
long | Tag |
Protected Member Functions inherited from Data::ComplexGeoData | |
Base::Vector3d | transformToOutside (const Base::Vector3f &vec) const |
from local to outside More... | |
Base::Vector3f | transformToInside (const Base::Vector3d &vec) const |
from local to inside More... | |
Static Protected Member Functions inherited from Base::BaseClass | |
static void | initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr) |
The representation of a FemMesh.
FemMesh::FemMesh | ( | ) |
FemMesh::FemMesh | ( | const FemMesh & | mesh | ) |
References SMESH_Gen::CreateMesh(), and getGenerator().
FemMesh::~FemMesh | ( | ) |
References SMESH_Mesh::Clear(), and SMESH_Mesh::ShapeToMesh().
int FemMesh::addGroup | ( | const std::string | TypeString, |
const std::string | Name, | ||
const int | theId = -1 |
||
) |
Adds group to mesh.
References SMESH_Mesh::AddGroup(), and getSMesh().
Adds elements to group (int due to int used by raw SMESH functions)
References SMESHDS_Group::Add(), SMESHDS_Group::Contains(), SMDS_Mesh::elementsIterator(), SMESH_Mesh::GetGroup(), SMDS_MeshElement::GetID(), SMESH_Mesh::GetMeshDS(), getSMesh(), and SMESHDS_GroupBase::GetType().
void FemMesh::addHypothesis | ( | const TopoDS_Shape & | aSubShape, |
SMESH_HypothesisPtr | hyp | ||
) |
References SMESH_Mesh::AddHypothesis().
Referenced by Fem::FemMeshShapeObject::execute().
void FemMesh::compute | ( | ) |
References SMESH_Gen::Compute(), getGenerator(), and SMESH_Mesh::GetShapeToMesh().
Referenced by Fem::FemMeshShapeObject::execute().
|
virtual |
Implements Data::ComplexGeoData.
|
virtual |
Bound box from the shape.
Implements Data::ComplexGeoData.
References SMESH_Mesh::GetMeshDS(), getSMesh(), SMDS_Mesh::nodesIterator(), draftgeoutils.general::vec(), SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().
retrieving volume IDs and CalculiX face number by face
That function returns map containing volume ID and face number as per CalculiX definition for tetrahedral elements. See CalculiX documentation for the details.
References DraftVecUtils::find(), SMDS_MeshElement::GetID(), SMESH_Mesh::GetMeshDS(), SMDS_MeshElement::GetNode(), getNodesByFace(), SMDS_MeshElement::NbNodes(), and SMDS_Mesh::volumesIterator().
std::list< int > FemMesh::getEdgesByEdge | ( | const TopoDS_Edge & | edge | ) | const |
retrieving edge IDs number by edge
References SMDS_Mesh::edgesIterator(), SMDS_MeshElement::GetID(), SMESH_Mesh::GetMeshDS(), SMDS_MeshElement::GetNode(), getNodesByEdge(), and SMDS_MeshElement::NbNodes().
std::set< int > FemMesh::getEdgesOnly | ( | void | ) | const |
retrieving IDs of edges not belonging to any face (and thus not belonging to any volume too)
References SMDS_Mesh::edgesIterator(), SMDS_Mesh::facesIterator(), getElementNodes(), SMDS_MeshElement::GetID(), and SMESH_Mesh::GetMeshDS().
Referenced by writeABAQUS().
retrieving node IDs by element ID
References SMDS_Mesh::FindElement(), SMDS_MeshElement::GetID(), SMESH_Mesh::GetMeshDS(), SMDS_MeshElement::GetNode(), and SMDS_MeshElement::NbNodes().
Referenced by getEdgesOnly(), and getFacesOnly().
|
virtual |
Sub type list List of different subelement types it is NOT a list of the subelements itself.
Implements Data::ComplexGeoData.
std::list< int > FemMesh::getFacesByFace | ( | const TopoDS_Face & | face | ) | const |
retrieving face IDs number by face
That function returns a list of face IDs.
References SMDS_Mesh::facesIterator(), SMESH_Mesh::GetMeshDS(), getNodesByFace(), and SMDS_MeshElement::NbNodes().
std::set< int > FemMesh::getFacesOnly | ( | void | ) | const |
retrieving IDs of faces not belonging to any volume
References SMDS_Mesh::facesIterator(), getElementNodes(), SMDS_MeshElement::GetID(), SMESH_Mesh::GetMeshDS(), and SMDS_Mesh::volumesIterator().
Referenced by writeABAQUS().
|
static |
struct Fem::FemMesh::FemMeshInfo FemMesh::getInfo | ( | void | ) | const |
References SMESH_Mesh::GetMeshDS(), getSMesh(), Fem::FemMesh::FemMeshInfo::numFaces, Fem::FemMesh::FemMeshInfo::numHedr, Fem::FemMesh::FemMeshInfo::numHexa, Fem::FemMesh::FemMeshInfo::numNode, Fem::FemMesh::FemMeshInfo::numPoly, Fem::FemMesh::FemMeshInfo::numPris, Fem::FemMesh::FemMeshInfo::numPyrd, Fem::FemMesh::FemMeshInfo::numQuad, Fem::FemMesh::FemMeshInfo::numTetr, Fem::FemMesh::FemMeshInfo::numTria, and Fem::FemMesh::FemMeshInfo::numVolu.
Referenced by FemGui::TaskTetParameter::setInfo(), and FemGui::TaskTetParameter::TaskTetParameter().
|
virtual |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB?
Implements Base::Persistence.
std::set< int > FemMesh::getNodesByEdge | ( | const TopoDS_Edge & | edge | ) | const |
retrieving by edge
References SMDS_MeshElement::GetID(), SMESH_Mesh::GetMeshDS(), getTransform(), SMDS_MeshNode::GetXYZ(), SMDS_Mesh::nodesIterator(), and draftgeoutils.general::vec().
Referenced by getEdgesByEdge().
std::set< int > FemMesh::getNodesByFace | ( | const TopoDS_Face & | face | ) | const |
retrieving by face
References SMDS_MeshElement::GetID(), SMESH_Mesh::GetMeshDS(), getTransform(), SMDS_MeshNode::GetXYZ(), SMDS_Mesh::nodesIterator(), and draftgeoutils.general::vec().
Referenced by getccxVolumesByFace(), getFacesByFace(), and getVolumesByFace().
std::set< int > FemMesh::getNodesBySolid | ( | const TopoDS_Solid & | solid | ) | const |
retrieving by solid
References Base::Console(), SMDS_MeshElement::GetID(), SMESH_Mesh::GetMeshDS(), getTransform(), SMDS_MeshNode::GetXYZ(), Base::ConsoleSingleton::Log(), SMDS_Mesh::nodesIterator(), and draftgeoutils.general::vec().
std::set< int > FemMesh::getNodesByVertex | ( | const TopoDS_Vertex & | vertex | ) | const |
retrieving by vertex
References Base::DistanceP2(), SMDS_MeshElement::GetID(), SMESH_Mesh::GetMeshDS(), getTransform(), SMDS_MeshNode::GetXYZ(), SMDS_Mesh::nodesIterator(), and draftgeoutils.general::vec().
SMESH_Mesh * FemMesh::getSMesh | ( | ) |
const SMESH_Mesh * FemMesh::getSMesh | ( | ) | const |
|
virtual |
get the subelement by type and number
Implements Data::ComplexGeoData.
std::set< long > FemMesh::getSurfaceNodes | ( | long | ElemId, |
short | FaceId, | ||
float | Angle = 360 |
||
) | const |
retrieving by region growing
|
virtual |
get the transformation
Implements Data::ComplexGeoData.
Referenced by getNodesByEdge(), getNodesByFace(), getNodesBySolid(), and getNodesByVertex().
Base::Quantity FemMesh::getVolume | ( | void | ) | const |
get the volume (when there are volume elements)
References SMESH_Mesh::GetMeshDS(), SMDS_MeshElement::GetNode(), SMDS_MeshElement::NbNodes(), draftgeoutils.general::v1(), SMDS_Mesh::volumesIterator(), SMDS_MeshNode::X(), Base::Vector3< _Precision >::x, SMDS_MeshNode::Y(), Base::Vector3< _Precision >::y, SMDS_MeshNode::Z(), and Base::Vector3< _Precision >::z.
retrieving volume IDs and face IDs number by face
That function returns map containing volume ID and face ID.
References SMDS_MeshElement::facesIterator(), SMDS_Mesh::facesIterator(), SMDS_MeshElement::GetID(), SMESH_Mesh::GetMeshDS(), getNodesByFace(), SMDS_MeshElement::NbNodes(), SMDS_MeshElement::nodeIterator(), and SMDS_Mesh::volumesIterator().
References SMESH_Gen::CreateMesh(), and getGenerator().
void FemMesh::read | ( | const char * | FileName | ) |
import from files
References SMESH_Mesh::DATToMesh(), Base::FileInfo::fileNamePure(), Base::FileInfo::filePath(), SMESH_Mesh::GetMeshDS(), Base::FileInfo::hasExtension(), Base::FileInfo::isReadable(), SMESH_Mesh::MEDToMesh(), SMDS_Mesh::NbNodes(), Fem::FemVTKTools::readVTKMesh(), SMESH_Mesh::STLToMesh(), and SMESH_Mesh::UNVToMesh().
Referenced by gzip_utf8.GzipFile::readline(), and gzip_utf8.GzipFile::seek().
Remove group (Name due to similarity to SMESH basis functions)
References getSMesh(), and SMESH_Mesh::RemoveGroup().
|
virtual |
This method is used to restore properties from an XML document.
It uses the XMLReader class, which bases on SAX, to read the in Save() written information. Again the Vector as an example:
Implements Base::Persistence.
References Base::XMLReader::addFile(), Base::XMLReader::getAttribute(), Base::XMLReader::getAttributeAsFloat(), Base::XMLReader::hasAttribute(), and Base::XMLReader::readElement().
|
virtual |
This method is used to restore large amounts of data from a file In this method you simply stream in your SaveDocFile() saved data.
Again you have to apply for the call of this method in the Restore() call:
After you issued the reader.addFile() your RestoreDocFile() is called:
Reimplemented from Base::Persistence.
References Base::FileInfo::deleteFile(), Base::FileInfo::filePath(), App::Application::getTempFileName(), and SMESH_Mesh::UNVToMesh().
|
virtual |
This method is used to save properties to an XML document.
A good example you'll find in PropertyStandard.cpp, e.g. the vector:
The writer.ind() expression writes the indentation, just for pretty printing of the XML. As you see, the writing of the XML document is not done with a DOM implementation because of performance reasons. Therefore the programmer has to take care that a valid XML document is written. This means closing tags and writing UTF-8.
Implements Base::Persistence.
References Base::Writer::addFile(), Base::Writer::ind(), Base::Writer::isForceXML(), and Base::Writer::Stream().
|
virtual |
This method is used to save large amounts of data to a binary file.
Sometimes it makes no sense to write property data as XML. In case the amount of data is too big or the data type has a more effective way to save itself. In this cases it is possible to write the data in a separate file inside the document archive. In case you want do so you have to re-implement SaveDocFile(). First, you have to inform the framework in Save() that you want do so. Here an example from the Mesh module which can save a (pontetionaly big) triangle mesh:
The writer.isForceXML() is an indication to force you to write XML. Regardless of size and effectiveness. The second part informs the Base::writer through writer.addFile("MeshKernel.bms", this) that this object wants to write a file with the given name. The method addFile() returns a unique name that then is written in the XML stream. This allows your RestoreDocFile() method to identify and read the file again. Later your SaveDocFile() method is called as many times as you issued the addFile() call:
In this method you can simply stream your content to the file (Base::Writer inheriting from ostream).
Reimplemented from Base::Persistence.
References Base::FileInfo::deleteFile(), SMESH_Mesh::ExportUNV(), Base::FileInfo::filePath(), App::Application::getTempFileName(), and Base::Writer::Stream().
void FemMesh::setStandardHypotheses | ( | ) |
References SMESH_Mesh::AddHypothesis(), getGenerator(), and SMESH_Mesh::GetShapeToMesh().
|
virtual |
set the transformation
Implements Data::ComplexGeoData.
Referenced by Fem::FemMeshObject::onChanged().
|
virtual |
Applies a transformation on the real geometric data type.
Implements Data::ComplexGeoData.
References SMESH_Mesh::GetMeshDS(), SMESHDS_Mesh::MoveNode(), SMDS_Mesh::nodesIterator(), Base::Vector3< _Precision >::Set(), SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().
void FemMesh::write | ( | const char * | FileName | ) | const |
References Base::Console(), SMESH_Mesh::ExportDAT(), SMESH_Mesh::ExportMED(), SMESH_Mesh::ExportSTL(), SMESH_Mesh::ExportUNV(), Base::FileInfo::fileNamePure(), Base::FileInfo::filePath(), App::GetApplication(), ParameterGrp::GetBool(), ParameterGrp::GetInt(), App::Application::GetParameterGroupByPath(), Base::FileInfo::hasExtension(), Base::ConsoleSingleton::Log(), writeABAQUS(), Fem::FemVTKTools::writeVTKMesh(), and writeZ88().
Referenced by gzip_utf8.GzipFile::seek().
References SMDS_Mesh::edgesIterator(), SMDS_Mesh::facesIterator(), SMDS_Mesh::FindElement(), getEdgesOnly(), SMESHDS_GroupBase::GetElements(), getFacesOnly(), SMESH_Mesh::GetGroup(), SMESH_Group::GetGroupDS(), SMESH_Mesh::GetGroupIds(), SMDS_MeshElement::GetID(), SMESH_Mesh::GetMeshDS(), SMESH_Group::GetName(), SMDS_MeshElement::GetNode(), SMESHDS_GroupBase::GetType(), SMDS_MeshElement::NbNodes(), SMDS_Mesh::nodesIterator(), Base::Vector3< _Precision >::Set(), SMDS_Mesh::volumesIterator(), SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().
Referenced by write().
void FemMesh::writeZ88 | ( | const std::string & | FileName | ) | const |
References Base::Console(), and Base::ConsoleSingleton::Log().
Referenced by write().