Skip to main content

DPF C++ client library 2023 R2

ansys::dpf::MeshedRegion Class Reference

Last update: 10.07.2023

Holds the mesh for a given region (body, faces, skin, ...) More...

#include <dpf_api.h>

Inheritance diagram for ansys::dpf::MeshedRegion:
ansys::dpf::DpfTypes

Public Member Functions

 MeshedRegion (Client const *const client)
 
 MeshedRegion (int id, Client const *const client)
 
 MeshedRegion (MeshedRegion const &)
 
 MeshedRegion (MeshedRegion &&)
 
MeshedRegionoperator= (MeshedRegion const &)
 
MeshedRegionoperator= (MeshedRegion &&)
 
dp_int numberOfNodes () const
 
dp_int numberOfElements () const
 
Unit lengthUnit () const
 
Field nodesCoordinates () const
 
PropertyField propField (PropertyType const &prop) const
 
bool hasPropField (PropertyType const &prop) const
 
std::vector< std::string > availablePropertyFields () const
 
PropertyField elementTypes () const
 
PropertyField connectivity () const
 
Scoping nodeScoping () const
 
Scoping elementScoping () const
 
Scoping faceScoping () const
 
std::vector< std::string > availableNamedSelections () const
 
Scoping namedSelection (std::string const &name) const
 
void fillCursor (dp_index element_index, ElementCursor &cursor) const
 
void prepareConstruction (dp_int n_nodes, dp_int n_elements)
 
void addNode (dp_id node_id, std::array< dp_double, 3 > const &data)
 
void addNode (dp_id node_id, dp_double *const data)
 
void addElement (ElementDescriptor const &descriptor, dp_id elem_id, std::vector< dp_index > const &node_indices)
 
void addElement (ansys::dpf::elements::EShape shape, dp_id elem_id, std::vector< dp_index > const &node_indices)
 
void setLengthUnit (Unit const &unit)
 
void setNamedSelectionScoping (std::string const &name, Scoping scoping)
 
void setPropertyField (std::string const &name, PropertyField property_field)
 
void setConnectivity (PropertyField connectivity)
 
void setElementTypes (PropertyField element_types)
 
void setNodesCoordinates (Field coordinates)
 
bool hasBeam () const
 
bool hasOnlyBeam () const
 
bool hasShell () const
 
bool hasOnlyShell () const
 
bool hasPoint () const
 
bool hasOnlyPoint () const
 
bool hasSolid () const
 
bool hasOnlySolid () const
 
bool hasSkin () const
 
bool hasOnlySkin () const
 
bool hasPolygons () const
 
bool hasPolyhedrons () const
 
ansys::dpf::ElementDescriptor elementDescriptorByElementId (dp_id element_id) const
 
ansys::dpf::elements::EShape elementShape (dp_id element_id) const
 
int numNodesOfElement (dp_index element_index) const
 
std::string name () const
 
void setName (std::string const &rhs)
 
MeshedRegion deep_copy (ansys::dpf::Client const *const client) const
 
MeshedRegion deep_copy () const
 
- Public Member Functions inherited from ansys::dpf::DpfTypes
virtual bool empty () const
 
virtual std::string describe () const
 
so::API const * callAPI () const
 
bool isOnCommonAPI () const
 
bool getClient (Client &client) const
 
bool hasBeenMovedLocally () const
 
bool isSameObject (DpfTypes const &rhs) const
 

Static Public Member Functions

static MeshedRegion emptyMeshedRegion ()
 

Detailed Description

Holds the mesh for a given region (body, faces, skin, ...)

The meshed region is an entity describing a mesh. Node and element scopings, element types, connectivity (list of node indices composing each element) and node coordinates are the fundamental entities composing the meshed region. It can also have materials, named selections...

Examples
AveragingTest.cpp, CompleteRST.cpp, DataApis.cpp, DataExport.cpp, ModelTest.cpp, and WorkflowExamples.cpp.

Constructor & Destructor Documentation

◆ MeshedRegion() [1/2]

ansys::dpf::MeshedRegion::MeshedRegion ( Client const *const  client)

Create a new meshed region on a server.

Parameters
[in]clientClient instance designating the IP, port and protocol to use.

◆ MeshedRegion() [2/2]

ansys::dpf::MeshedRegion::MeshedRegion ( int  id,
Client const *const  client 
)

Retrieve an existing instance of MeshedRegion on a server.

Parameters
[in]idId of the MeshedRegion object on the server's database.
[in]clientClient instance designating the IP, port and protocol to use.

Member Function Documentation

◆ addElement() [1/2]

void ansys::dpf::MeshedRegion::addElement ( ansys::dpf::elements::EShape  shape,
dp_id  elem_id,
std::vector< dp_index > const &  node_indices 
)

Add element to mesh.

Parameters
[in]shapeShape of the element.
[in]elem_idId of element.
[in]node_indicesVector of node ids of element.

◆ addElement() [2/2]

void ansys::dpf::MeshedRegion::addElement ( ElementDescriptor const &  descriptor,
dp_id  elem_id,
std::vector< dp_index > const &  node_indices 
)

Add element to mesh. Not available in remote, use the implementation with the element shape instead.

Parameters
[in]descriptorDescription of element.
[in]elem_idId of element.
[in]node_indicesVector of node ids of element.
Examples
DataApis.cpp, and DataExport.cpp.

◆ addNode() [1/2]

void ansys::dpf::MeshedRegion::addNode ( dp_id  node_id,
dp_double *const  data 
)

Add node to mesh.

Parameters
[in]node_idId of node.
[in]dataXYZ coordinates of node.

◆ addNode() [2/2]

void ansys::dpf::MeshedRegion::addNode ( dp_id  node_id,
std::array< dp_double, 3 > const &  data 
)

Add node to mesh.

Parameters
[in]node_idId of node.
[in]dataXYZ coordinates of node.
Examples
DataApis.cpp, and DataExport.cpp.

◆ availableNamedSelections()

std::vector< std::string > ansys::dpf::MeshedRegion::availableNamedSelections ( ) const
Returns
Vector of named selections withing mesh.
Examples
CompleteRST.cpp, ModelTest.cpp, and WorkflowExamples.cpp.

◆ availablePropertyFields()

std::vector< std::string > ansys::dpf::MeshedRegion::availablePropertyFields ( ) const
Returns
Vector of property fields withing mesh. See property_types for examples of available types.

◆ connectivity()

PropertyField ansys::dpf::MeshedRegion::connectivity ( ) const
Returns
Property field describing element connectivity for mesh.
Examples
DataApis.cpp, and ModelTest.cpp.

◆ deep_copy() [1/2]

MeshedRegion ansys::dpf::MeshedRegion::deep_copy ( ) const

Make a deep copy locally.

◆ deep_copy() [2/2]

MeshedRegion ansys::dpf::MeshedRegion::deep_copy ( ansys::dpf::Client const *const  client) const

Create a new MeshedRegion on a server by copying all the data of this MeshedRegion.

Parameters
[in]clientClient instance designating the IP, port and protocol to use.
Examples
DataExport.cpp.

◆ elementDescriptorByElementId()

ansys::dpf::ElementDescriptor ansys::dpf::MeshedRegion::elementDescriptorByElementId ( dp_id  element_id) const

Get ElementDescriptor (type related information) from element id. .

◆ elementScoping()

Scoping ansys::dpf::MeshedRegion::elementScoping ( ) const
Returns
Scoping describing elements of mesh.
Examples
DataApis.cpp, and DataExport.cpp.

◆ elementShape()

ansys::dpf::elements::EShape ansys::dpf::MeshedRegion::elementShape ( dp_id  element_id) const

Get element shape.

◆ elementTypes()

PropertyField ansys::dpf::MeshedRegion::elementTypes ( ) const
Returns
Property field describing element types within mesh.
Examples
DataApis.cpp.

◆ faceScoping()

Scoping ansys::dpf::MeshedRegion::faceScoping ( ) const
Returns
Scoping describing faces of mesh.

◆ fillCursor()

void ansys::dpf::MeshedRegion::fillCursor ( dp_index  element_index,
ElementCursor cursor 
) const

Get a cursor for given element.

Parameters
[in]element_indexIndex of element within mesh for which to get cursor.
[out]cursorCursor for given element.
Examples
DataApis.cpp.

◆ hasBeam()

bool ansys::dpf::MeshedRegion::hasBeam ( ) const
Returns
Indication if mesh contains beam elements.

◆ hasOnlyBeam()

bool ansys::dpf::MeshedRegion::hasOnlyBeam ( ) const
Returns
Indication if mesh only contains beam elements.

◆ hasOnlyPoint()

bool ansys::dpf::MeshedRegion::hasOnlyPoint ( ) const
Returns
Indication if mesh only contains point elements.

◆ hasOnlyShell()

bool ansys::dpf::MeshedRegion::hasOnlyShell ( ) const
Returns
Indication if mesh only contains shell elements.

◆ hasOnlySkin()

bool ansys::dpf::MeshedRegion::hasOnlySkin ( ) const
Returns
Indication if mesh only contains skin elements.

◆ hasOnlySolid()

bool ansys::dpf::MeshedRegion::hasOnlySolid ( ) const
Returns
Indication if mesh only contains solid elements.

◆ hasPoint()

bool ansys::dpf::MeshedRegion::hasPoint ( ) const
Returns
Indication if mesh contains point elements.

◆ hasPolygons()

bool ansys::dpf::MeshedRegion::hasPolygons ( ) const
Returns
Indication if mesh contains Polygonal elements.

◆ hasPolyhedrons()

bool ansys::dpf::MeshedRegion::hasPolyhedrons ( ) const
Returns
Indication if mesh contains Polyhedral elements.

◆ hasPropField()

bool ansys::dpf::MeshedRegion::hasPropField ( PropertyType const &  prop) const
Returns
Indication that property type exists.
Parameters
[in]propProperty type of which to check existence.

◆ hasShell()

bool ansys::dpf::MeshedRegion::hasShell ( ) const
Returns
Indication if mesh contains shell elements.

◆ hasSkin()

bool ansys::dpf::MeshedRegion::hasSkin ( ) const
Returns
Indication if mesh contains skin elements.

◆ hasSolid()

bool ansys::dpf::MeshedRegion::hasSolid ( ) const
Returns
Indication if mesh contains solid elements.

◆ lengthUnit()

Unit ansys::dpf::MeshedRegion::lengthUnit ( ) const
Returns
Length unit for mesh.
Examples
CompleteRST.cpp, and DataExport.cpp.

◆ name()

std::string ansys::dpf::MeshedRegion::name ( ) const
Returns
Name of the mesh.

◆ namedSelection()

Scoping ansys::dpf::MeshedRegion::namedSelection ( std::string const &  name) const
Returns
Scoping for given named selection.
Parameters
[in]nameName of which to get scoping.
Examples
CompleteRST.cpp, and ModelTest.cpp.

◆ nodesCoordinates()

Field ansys::dpf::MeshedRegion::nodesCoordinates ( ) const
Returns
Field containing mesh node coordinates.
Examples
DataApis.cpp, DataExport.cpp, and ModelTest.cpp.

◆ nodeScoping()

Scoping ansys::dpf::MeshedRegion::nodeScoping ( ) const
Returns
Scoping describing nodes of mesh.
Examples
DataApis.cpp, and DataExport.cpp.

◆ numberOfElements()

dp_int ansys::dpf::MeshedRegion::numberOfElements ( ) const
Returns
Number of elements in mesh.
Examples
CompleteRST.cpp, DataExport.cpp, and ModelTest.cpp.

◆ numberOfNodes()

dp_int ansys::dpf::MeshedRegion::numberOfNodes ( ) const
Returns
Number of nodes in mesh.
Examples
CompleteRST.cpp, DataExport.cpp, and ModelTest.cpp.

◆ numNodesOfElement()

int ansys::dpf::MeshedRegion::numNodesOfElement ( dp_index  element_index) const

Get number of nodes for element at given index.

◆ prepareConstruction()

void ansys::dpf::MeshedRegion::prepareConstruction ( dp_int  n_nodes,
dp_int  n_elements 
)

Allocate and reserve space for given number of nodes and elements. node scoping and coordinates vectors are reserved for n_nodes, elements scoping, connectivity and elements type property field are reserved for n_elements. this method should always be called before adding any node or element.

Parameters
[in]n_nodesExpected number of nodes within mesh.
[in]n_elementsExpected number of elements within mesh.
Examples
DataApis.cpp, and DataExport.cpp.

◆ propField()

PropertyField ansys::dpf::MeshedRegion::propField ( PropertyType const &  prop) const
Returns
Property field given by property type.
Parameters
[in]propProperty type of which to get property field.

◆ setConnectivity()

void ansys::dpf::MeshedRegion::setConnectivity ( PropertyField  connectivity)

Set a connectivity (nodes of the elements) property field.

Parameters
[in]connectivityConnectivity to set.

◆ setElementTypes()

void ansys::dpf::MeshedRegion::setElementTypes ( PropertyField  element_types)

Set element types property field.

Parameters
[in]element_typesElement types data to set..

◆ setLengthUnit()

void ansys::dpf::MeshedRegion::setLengthUnit ( Unit const &  unit)

Set length unit for mesh.

Parameters
[in]unitLength unit for mesh.
Examples
DataExport.cpp.

◆ setName()

void ansys::dpf::MeshedRegion::setName ( std::string const &  rhs)

Set mesh name.

◆ setNamedSelectionScoping()

void ansys::dpf::MeshedRegion::setNamedSelectionScoping ( std::string const &  name,
Scoping  scoping 
)

Set a named selection scoping for mesh.

Parameters
[in]nameNamed selection name.
[in]scopingScoping to set.

◆ setNodesCoordinates()

void ansys::dpf::MeshedRegion::setNodesCoordinates ( Field  coordinates)

Set a field for mesh.

Parameters
[in]coordinatesField to set.
Examples
DataExport.cpp.

◆ setPropertyField()

void ansys::dpf::MeshedRegion::setPropertyField ( std::string const &  name,
PropertyField  property_field 
)

Set an elemental property field for mesh. Its elemental scoping must be equal to the one that has already been set into the mesh, if it exists.

Parameters
[in]nameProperty name:
See also
common_property_names.
Parameters
[in]property_fieldProperty field to set.