mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
23427: [CEA 2073] No hypothesis "Viscous Layers" with Netgen 1D-2D-3D
Add GetElementsByNodes() that return elements including all given nodes.
This commit is contained in:
parent
c150e1e4c4
commit
69aa7507f2
@ -19,7 +19,7 @@ and hypotheses.
|
|||||||
|
|
||||||
Mesh generation on the geometry is performed in the bottom-up
|
Mesh generation on the geometry is performed in the bottom-up
|
||||||
flow: nodes on vertices are created first, then edges are divided into
|
flow: nodes on vertices are created first, then edges are divided into
|
||||||
segments using nodes on vertices; the node of segments are then
|
segments using nodes on vertices; the nodes of segments are then
|
||||||
used to mesh faces; then the nodes of faces are used to mesh
|
used to mesh faces; then the nodes of faces are used to mesh
|
||||||
solids. This automatically assures the conformity of the mesh.
|
solids. This automatically assures the conformity of the mesh.
|
||||||
|
|
||||||
|
@ -975,6 +975,11 @@ module SMESH
|
|||||||
*/
|
*/
|
||||||
long FindElementByNodes(in long_array nodes);
|
long FindElementByNodes(in long_array nodes);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Return elements including all given nodes.
|
||||||
|
*/
|
||||||
|
long_array GetElementsByNodes(in long_array nodes, in ElementType elem_type);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns true if given element is polygon
|
* Returns true if given element is polygon
|
||||||
*/
|
*/
|
||||||
|
@ -2458,6 +2458,49 @@ const SMDS_MeshElement* SMDS_Mesh::FindElement (const vector<const SMDS_MeshNode
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Return elements including all given nodes
|
||||||
|
* \param [in] nodes - nodes to find elements around
|
||||||
|
* \param [out] foundElems - the found elements
|
||||||
|
* \param [in] type - type of elements to find
|
||||||
|
* \return int - a number of found elements
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
int SMDS_Mesh::GetElementsByNodes(const std::vector<const SMDS_MeshNode *>& nodes,
|
||||||
|
std::vector<const SMDS_MeshElement *>& foundElems,
|
||||||
|
const SMDSAbs_ElementType type)
|
||||||
|
{
|
||||||
|
// chose a node with minimal number of inverse elements
|
||||||
|
const SMDS_MeshNode* n0 = nodes[0];
|
||||||
|
int minNbInverse = n0 ? n0->NbInverseElements( type ) : 1000;
|
||||||
|
for ( size_t i = 1; i < nodes.size(); ++i )
|
||||||
|
if ( nodes[i] && nodes[i]->NbInverseElements( type ) < minNbInverse )
|
||||||
|
{
|
||||||
|
n0 = nodes[i];
|
||||||
|
minNbInverse = n0->NbInverseElements( type );
|
||||||
|
}
|
||||||
|
|
||||||
|
foundElems.clear();
|
||||||
|
if ( n0 )
|
||||||
|
{
|
||||||
|
foundElems.reserve( minNbInverse );
|
||||||
|
SMDS_ElemIteratorPtr eIt = n0->GetInverseElementIterator( type );
|
||||||
|
while ( eIt->more() )
|
||||||
|
{
|
||||||
|
const SMDS_MeshElement* e = eIt->next();
|
||||||
|
bool includeAll = true;
|
||||||
|
for ( size_t i = 0; i < nodes.size() && includeAll; ++i )
|
||||||
|
if ( nodes[i] != n0 && e->GetNodeIndex( nodes[i] ) < 0 )
|
||||||
|
includeAll = false;
|
||||||
|
if ( includeAll )
|
||||||
|
foundElems.push_back( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return foundElems.size();
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : DumpNodes
|
//function : DumpNodes
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -689,6 +689,9 @@ public:
|
|||||||
static const SMDS_MeshElement* FindElement(const std::vector<const SMDS_MeshNode *>& nodes,
|
static const SMDS_MeshElement* FindElement(const std::vector<const SMDS_MeshNode *>& nodes,
|
||||||
const SMDSAbs_ElementType type=SMDSAbs_All,
|
const SMDSAbs_ElementType type=SMDSAbs_All,
|
||||||
const bool noMedium=true);
|
const bool noMedium=true);
|
||||||
|
static int GetElementsByNodes(const std::vector<const SMDS_MeshNode *>& nodes,
|
||||||
|
std::vector<const SMDS_MeshElement *>& foundElems,
|
||||||
|
const SMDSAbs_ElementType type=SMDSAbs_All);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Raise an exception if free memory (ram+swap) too low
|
* \brief Raise an exception if free memory (ram+swap) too low
|
||||||
|
@ -4771,6 +4771,35 @@ CORBA::Long SMESH_Mesh_i::FindElementByNodes(const SMESH::long_array& nodes)
|
|||||||
return elemID;
|
return elemID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Return elements including all given nodes.
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
SMESH::long_array* SMESH_Mesh_i::GetElementsByNodes(const SMESH::long_array& nodes,
|
||||||
|
SMESH::ElementType elemType)
|
||||||
|
{
|
||||||
|
if ( _preMeshInfo )
|
||||||
|
_preMeshInfo->FullLoadFromFile();
|
||||||
|
|
||||||
|
SMESH::long_array_var result = new SMESH::long_array();
|
||||||
|
|
||||||
|
if ( SMESHDS_Mesh* mesh = _impl->GetMeshDS() )
|
||||||
|
{
|
||||||
|
vector< const SMDS_MeshNode * > nn( nodes.length() );
|
||||||
|
for ( CORBA::ULong i = 0; i < nodes.length(); ++i )
|
||||||
|
nn[i] = mesh->FindNode( nodes[i] );
|
||||||
|
|
||||||
|
std::vector<const SMDS_MeshElement *> elems;
|
||||||
|
mesh->GetElementsByNodes( nn, elems, (SMDSAbs_ElementType) elemType );
|
||||||
|
result->length( elems.size() );
|
||||||
|
for ( size_t i = 0; i < elems.size(); ++i )
|
||||||
|
result[i] = elems[i]->GetID();
|
||||||
|
}
|
||||||
|
return result._retn();
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* Returns true if given element is polygon
|
* Returns true if given element is polygon
|
||||||
|
@ -536,8 +536,8 @@ public:
|
|||||||
* Returns true if given node is medium node
|
* Returns true if given node is medium node
|
||||||
* in one of quadratic elements
|
* in one of quadratic elements
|
||||||
*/
|
*/
|
||||||
CORBA::Boolean IsMediumNodeOfAnyElem(CORBA::Long idn,
|
CORBA::Boolean IsMediumNodeOfAnyElem(CORBA::Long idn,
|
||||||
SMESH::ElementType theElemType);
|
SMESH::ElementType elemType);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns number of edges for given element
|
* Returns number of edges for given element
|
||||||
@ -563,6 +563,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
CORBA::Long FindElementByNodes(const SMESH::long_array& nodes);
|
CORBA::Long FindElementByNodes(const SMESH::long_array& nodes);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Return elements including all given nodes.
|
||||||
|
*/
|
||||||
|
SMESH::long_array* GetElementsByNodes(const SMESH::long_array& nodes,
|
||||||
|
SMESH::ElementType elemType);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns true if given element is polygon
|
* Returns true if given element is polygon
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user