IMP 0020089: Take into account 0D elements (MED_POINT1)

This commit is contained in:
jfa 2009-07-16 13:33:03 +00:00
parent f5a2b6350e
commit 4592fecfcf
46 changed files with 1116 additions and 256 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1014 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -6,6 +6,7 @@
<ul>
<li>\ref adding_nodes_anchor "Nodes"</li>
<li>\ref adding_0delems_anchor "0D Elements"</li>
<li>\ref adding_edges_anchor "Edges"</li>
<li>\ref adding_triangles_anchor "Triangles"</li>
<li>\ref adding_quadrangles_anchor "Quadrangles"</li>
@ -43,6 +44,18 @@ created:
\image html add_node.png
<br>
\anchor adding_0delems_anchor
<h2>Adding 0D elements</h2>
\image html add0delement.png
In this dialog box specify the node which will form your 0d element by
selecting it in the 3D viewer and click the \b Apply or
<b>Apply and Close</b> button. Your 0D element will be created:
\image html add_0delement.png
<br>
\anchor adding_edges_anchor
<h2>Adding edges</h2>
@ -137,4 +150,4 @@ button. If you've managed to obtain the necessary result, click the
\image html add_polyhedron.png
*/
*/

View File

@ -46,6 +46,7 @@ module SMESH
enum log_command
{
ADD_NODE,
ADD_ELEM0D,
ADD_EDGE,
ADD_TRIANGLE,
ADD_QUADRANGLE,
@ -110,6 +111,7 @@ module SMESH
{
ALL,
NODE,
ELEM0D,
EDGE,
FACE,
VOLUME
@ -532,6 +534,9 @@ module SMESH
long NbElements()
raises (SALOME::SALOME_Exception);
long Nb0DElements()
raises (SALOME::SALOME_Exception);
long NbEdges()
raises (SALOME::SALOME_Exception);

View File

@ -41,6 +41,12 @@ module SMESH
long AddNode(in double x, in double y, in double z);
/*!
* Create 0D element on the given node.
* \param IdOfNode Node IDs for creation of element.
*/
long Add0DElement(in long IDOfNode);
/*!
* Create edge, either linear and quadratic (this is determed
* by number of given nodes).

View File

@ -31,8 +31,10 @@
<parameter name="fill_color" value="0, 170, 255"/>
<parameter name="outline_color" value="0, 170, 255"/>
<parameter name="backface_color" value="0, 0, 255"/>
<parameter name="elem0d_color" value="0, 255, 0"/>
<parameter name="highlight_color" value="0, 255, 255"/>
<parameter name="node_size" value="3" />
<parameter name="elem0d_size" value="5" />
<parameter name="element_width" value="1" />
<parameter name="shrink_coeff" value="75"/>
<parameter name="orientation_color" value="255, 255, 255"/>

View File

@ -395,6 +395,16 @@ DriverMED_R_SMESHDS_Mesh
//MESSAGE("Try to create element # " << iElem << " with id = "
// << aCellInfo->GetElemNum(iElem));
switch(aGeom) {
case ePOINT1:
//anElement = FindNode(myMesh,aNodeIds[0]);
if(anIsElemNum)
anElement = myMesh->Add0DElementWithID
(aNodeIds[0], aCellInfo->GetElemNum(iElem));
if (!anElement) {
anElement = myMesh->Add0DElement(FindNode(myMesh,aNodeIds[0]));
isRenum = anIsElemNum;
}
break;
case eSEG2:
if(anIsElemNum)
anElement = myMesh->AddEdgeWithID(aNodeIds[0],
@ -680,11 +690,8 @@ DriverMED_R_SMESHDS_Mesh
isRenum = anIsElemNum;
}
break;
case ePOINT1:
anElement = FindNode(myMesh,aNodeIds[0]);
break;
}
#ifndef _DEXCEPT_
}catch(const std::exception& exc){
//INFOS("Follow exception was cought:\n\t"<<exc.what());

View File

@ -223,8 +223,9 @@ namespace{
//-------------------------------------------------------
/*!
* \brief Class helping to use either SMDS_EdgeIterator, SMDS_FaceIterator
* or SMDS_VolumeIterator in the same code
* \brief Class helping to use either SMDS_0DElementIterator,
* SMDS_EdgeIterator, SMDS_FaceIterator or SMDS_VolumeIterator
* in the same code
*/
//-------------------------------------------------------
struct TElemIterator
@ -244,6 +245,7 @@ namespace{
else return 0;
}
};
typedef TypedElemIterator< SMDS_0DElementIteratorPtr > T0DElementIterator;
typedef TypedElemIterator< SMDS_EdgeIteratorPtr > TEdgeIterator;
typedef TypedElemIterator< SMDS_FaceIteratorPtr > TFaceIterator;
typedef TypedElemIterator< SMDS_VolumeIteratorPtr > TVolumeIterator;
@ -422,10 +424,12 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
// Storing SMDS groups and sub-meshes as med families
//----------------------------------------------------
int myNodesDefaultFamilyId = 0;
int my0DElementsDefaultFamilyId = 0;
int myEdgesDefaultFamilyId = 0;
int myFacesDefaultFamilyId = 0;
int myVolumesDefaultFamilyId = 0;
int nbNodes = myMesh->NbNodes();
int nb0DElements = myMesh->Nb0DElements();
int nbEdges = myMesh->NbEdges();
int nbFaces = myMesh->NbFaces();
int nbVolumes = myMesh->NbVolumes();
@ -533,6 +537,13 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
list< TElemTypeData > aTElemTypeDatas;
EEntiteMaillage anEntity = eMAILLE;
#ifdef _ELEMENTS_BY_DIM_
anEntity = eNOEUD_ELEMENT;
#endif
aTElemTypeDatas.push_back(TElemTypeData(anEntity,
ePOINT1,
nbElemInfo.Nb0DElements(),
SMDSAbs_0DElement));
#ifdef _ELEMENTS_BY_DIM_
anEntity = eARETE;
#endif
@ -635,6 +646,10 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
PElemIterator elemIterator;
int defaultFamilyId = 0;
switch ( aElemTypeData->_smdsType ) {
case SMDSAbs_0DElement:
elemIterator = PElemIterator( new T0DElementIterator( myMesh->elements0dIterator() ));
defaultFamilyId = my0DElementsDefaultFamilyId;
break;
case SMDSAbs_Edge:
elemIterator = PElemIterator( new TEdgeIterator( myMesh->edgesIterator() ));
defaultFamilyId = myEdgesDefaultFamilyId;

View File

@ -120,17 +120,18 @@ SMESH_ActorDef::SMESH_ActorDef()
myControlsPrecision = -1;
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
//Definition 2D and 3D divices of the actor
//Definition 2D and 3D devices of the actor
//-----------------------------------------
vtkFloatingPointType anRGB[3] = {1,1,1};
mySurfaceProp = vtkProperty::New();
@ -194,7 +195,7 @@ SMESH_ActorDef::SMESH_ActorDef()
aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
//Definition 1D divice of the actor
//Definition 1D device of the actor
//---------------------------------
myEdgeProp = vtkProperty::New();
myEdgeProp->SetAmbient(1.0);
@ -242,8 +243,49 @@ SMESH_ActorDef::SMESH_ActorDef()
aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
//Definition 0D divice of the actor
//---------------------------------
//Definition 0D device of the actor (0d elements)
//-----------------------------------------------
my0DProp = vtkProperty::New();
SMESH::GetColor( "SMESH", "elem0d_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
my0DProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
my0DProp->SetPointSize(aElem0DSize);
my0DActor = SMESH_DeviceActor::New();
my0DActor->SetUserMatrix(aMatrix);
my0DActor->SetStoreClippingMapping(true);
my0DActor->PickableOff();
my0DActor->SetVisibility(false);
my0DActor->SetProperty(my0DProp);
my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
aFilter = my0DActor->GetExtractUnstructuredGrid();
//aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aFilter->RegisterCellsWithType(VTK_VERTEX);
//my0DExtProp = vtkProperty::New();
//my0DExtProp->DeepCopy(my0DProp);
//anRGB[0] = 1 - anRGB[0];
//anRGB[1] = 1 - anRGB[1];
//anRGB[2] = 1 - anRGB[2];
//my0DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
//my0DExtProp->SetPointSize(aElem0DSize);
//
//my0DExtActor = SMESH_DeviceActor::New();
//my0DExtActor->SetUserMatrix(aMatrix);
//my0DExtActor->SetStoreClippingMapping(true);
//my0DExtActor->PickableOff();
//my0DExtActor->SetHighlited(true);
//my0DExtActor->SetVisibility(false);
//my0DExtActor->SetProperty(my0DExtProp);
//my0DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
//aFilter = my0DExtActor->GetExtractUnstructuredGrid();
////aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
//aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
//aFilter->RegisterCellsWithType(VTK_VERTEX);
//Definition 0D device of the actor (nodes)
//-----------------------------------------
myNodeProp = vtkProperty::New();
SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
@ -288,23 +330,25 @@ SMESH_ActorDef::SMESH_ActorDef()
myBaseActor->GetProperty()->SetOpacity(0.0);
myPickableActor = myBaseActor;
myHighlightProp = vtkProperty::New();
myHighlightProp->SetAmbient(1.0);
myHighlightProp->SetDiffuse(0.0);
myHighlightProp->SetSpecular(0.0);
SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myHighlightProp->SetPointSize(aPointSize);
//myHighlightProp->SetPointSize(aPointSize);
myHighlightProp->SetPointSize(std::max(aElem0DSize,aPointSize)); // ??
myHighlightProp->SetRepresentation(1);
myPreselectProp = vtkProperty::New();
myPreselectProp->SetAmbient(1.0);
myPreselectProp->SetDiffuse(0.0);
myPreselectProp->SetSpecular(0.0);
SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myPreselectProp->SetPointSize(aPointSize);
//myPreselectProp->SetPointSize(aPointSize);
myPreselectProp->SetPointSize(std::max(aElem0DSize,aPointSize)); // ??
myPreselectProp->SetRepresentation(1);
myHighlitableActor = SMESH_DeviceActor::New();
@ -461,6 +505,12 @@ SMESH_ActorDef::~SMESH_ActorDef()
myNodeProp->Delete();
myNodeExtProp->Delete();
my0DProp->Delete();
my0DActor->Delete();
//my0DExtProp->Delete();
//my0DExtActor->Delete();
my1DProp->Delete();
my1DActor->Delete();
@ -479,7 +529,7 @@ SMESH_ActorDef::~SMESH_ActorDef()
myHighlitableActor->Delete();
//Deleting of pints numbering pipeline
//Deleting of points numbering pipeline
//---------------------------------------
myPointsNumDataSet->Delete();
@ -621,6 +671,7 @@ SetControlMode(eControl theMode,
myControlMode = eNone;
theCheckEntityMode &= mgr->booleanValue( "SMESH", "display_entity", false );
my0DActor->GetMapper()->SetScalarVisibility(false);
my1DActor->GetMapper()->SetScalarVisibility(false);
my2DActor->GetMapper()->SetScalarVisibility(false);
my3DActor->GetMapper()->SetScalarVisibility(false);
@ -806,6 +857,9 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
theRenderer->AddActor(my1DActor);
theRenderer->AddActor(my1DExtActor);
theRenderer->AddActor(my0DActor);
//theRenderer->AddActor(my0DExtActor);
theRenderer->AddActor(myHighlitableActor);
theRenderer->AddActor2D(myScalarBarActor);
@ -827,6 +881,9 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
theRenderer->RemoveActor(myHighlitableActor);
theRenderer->RemoveActor(my0DActor);
//theRenderer->RemoveActor(my0DExtActor);
theRenderer->RemoveActor(my1DActor);
theRenderer->RemoveActor(my1DExtActor);
@ -859,6 +916,9 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
my0DActor->Init(myVisualObj,myImplicitBoolean);
//my0DExtActor->Init(myVisualObj,myImplicitBoolean);
my1DActor->Init(myVisualObj,myImplicitBoolean);
my1DExtActor->Init(myVisualObj,myImplicitBoolean);
@ -866,6 +926,9 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
my2DExtActor->Init(myVisualObj,myImplicitBoolean);
my3DActor->Init(myVisualObj,myImplicitBoolean);
my0DActor->GetMapper()->SetLookupTable(myLookupTable);
//my0DExtActor->GetMapper()->SetLookupTable(myLookupTable);
my1DActor->GetMapper()->SetLookupTable(myLookupTable);
my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
@ -931,6 +994,9 @@ void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
myNodeExtActor->SetTransform(theTransform);
my0DActor->SetTransform(theTransform);
//my0DExtActor->SetTransform(theTransform);
my1DActor->SetTransform(theTransform);
my1DExtActor->SetTransform(theTransform);
@ -1060,6 +1126,9 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
myNodeExtActor->VisibilityOff();
my0DActor->VisibilityOff();
//my0DExtActor->VisibilityOff();
my1DActor->VisibilityOff();
my1DExtActor->VisibilityOff();
@ -1102,6 +1171,10 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
myNodeActor->VisibilityOn();
}
if(myEntityMode & e0DElements){
my0DActor->VisibilityOn();
}
if(myEntityMode & eEdges){
my1DActor->VisibilityOn();
}
@ -1127,25 +1200,34 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
}
void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
{
myEntityState = eAllEntity;
if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)){
if(!myVisualObj->GetNbEntities(SMDSAbs_0DElement)) {
myEntityState &= ~e0DElements;
theMode &= ~e0DElements;
}
if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) {
myEntityState &= ~eEdges;
theMode &= ~eEdges;
}
if(!myVisualObj->GetNbEntities(SMDSAbs_Face)){
if(!myVisualObj->GetNbEntities(SMDSAbs_Face)) {
myEntityState &= ~eFaces;
theMode &= ~eFaces;
}
if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)){
if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) {
myEntityState &= ~eVolumes;
theMode &= ~eVolumes;
}
if(!theMode){
if (!theMode) {
if(myVisualObj->GetNbEntities(SMDSAbs_0DElement))
theMode |= e0DElements;
if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
theMode |= eEdges;
@ -1168,8 +1250,13 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
aHightFilter->ClearRegisteredCellsWithType();
aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
if(myEntityMode & eEdges){
if (myEntityMode & e0DElements) {
if (MYDEBUG) MESSAGE("0D ELEMENTS");
aFilter->RegisterCellsWithType(VTK_VERTEX);
aHightFilter->RegisterCellsWithType(VTK_VERTEX);
}
if (myEntityMode & eEdges) {
if (MYDEBUG) MESSAGE("EDGES");
aFilter->RegisterCellsWithType(VTK_LINE);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
@ -1178,7 +1265,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
}
if(myEntityMode & eFaces){
if (myEntityMode & eFaces) {
if (MYDEBUG) MESSAGE("FACES");
aFilter->RegisterCellsWithType(VTK_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_POLYGON);
@ -1193,7 +1280,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
}
if(myEntityMode & eVolumes){
if (myEntityMode & eVolumes) {
if (MYDEBUG) MESSAGE("VOLUMES");
aFilter->RegisterCellsWithType(VTK_TETRA);
aFilter->RegisterCellsWithType(VTK_VOXEL);
@ -1220,37 +1307,39 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
SetVisibility(GetVisibility(),false);
}
void SMESH_ActorDef::SetRepresentation(int theMode){
void SMESH_ActorDef::SetRepresentation (int theMode)
{
int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
if(theMode < 0){
if (theMode < 0) {
myRepresentation = eSurface;
if(!aNbFaces && !aNbVolumes && aNbEdges){
if (!aNbFaces && !aNbVolumes && aNbEdges) {
myRepresentation = eEdge;
}else if(!aNbFaces && !aNbVolumes && !aNbEdges){
} else if (!aNbFaces && !aNbVolumes && !aNbEdges) {
myRepresentation = ePoint;
}
}else{
switch(theMode){
} else {
switch (theMode) {
case eEdge:
if(!aNbFaces && !aNbVolumes && !aNbEdges) return;
if (!aNbFaces && !aNbVolumes && !aNbEdges) return;
break;
case eSurface:
if(!aNbFaces && !aNbVolumes) return;
if (!aNbFaces && !aNbVolumes) return;
break;
}
myRepresentation = theMode;
}
if(!GetUnstructuredGrid()->GetNumberOfCells())
if (!GetUnstructuredGrid()->GetNumberOfCells())
myRepresentation = ePoint;
if(myIsShrunk){
if(myRepresentation == ePoint){
if (myIsShrunk) {
if (myRepresentation == ePoint) {
UnShrink();
myIsShrunk = true;
}else{
} else {
SetShrink();
}
}
@ -1261,7 +1350,7 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
vtkProperty *aProp = NULL, *aBackProp = NULL;
SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation();
switch(myRepresentation){
switch (myRepresentation) {
case ePoint:
myPickableActor = myNodeActor;
myNodeActor->SetVisibility(true);
@ -1278,7 +1367,7 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
aBackProp = myBackSurfaceProp;
aReperesent = SMESH_DeviceActor::eSurface;
break;
}
}
my2DActor->SetProperty(aProp);
my2DActor->SetBackfaceProperty(aBackProp);
@ -1295,9 +1384,16 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
my3DActor->SetBackfaceProperty(aBackProp);
my3DActor->SetRepresentation(aReperesent);
//my0DExtActor->SetVisibility(false);
my1DExtActor->SetVisibility(false);
my2DExtActor->SetVisibility(false);
// ???
//my0DActor->SetProperty(aProp);
//my0DActor->SetBackfaceProperty(aBackProp);
my0DActor->SetRepresentation(aReperesent);
//my0DExtActor->SetRepresentation(aReperesent);
switch(myControlMode){
case eLength:
case eMultiConnection:
@ -1311,14 +1407,13 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
my1DActor->SetQuadraticArcMode(false);
else if(aQuadraticMode == SMESH_Actor::eArcs)
my1DActor->SetQuadraticArcMode(true);
my1DActor->SetProperty(aProp);
my1DActor->SetBackfaceProperty(aBackProp);
my1DActor->SetRepresentation(aReperesent);
my1DExtActor->SetRepresentation(aReperesent);
if(myIsPointsVisible)
myPickableActor = myNodeActor;
if(GetPointRepresentation())
@ -1567,8 +1662,12 @@ void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
void SMESH_ActorDef::SetNodeSize(vtkFloatingPointType theVal){
myNodeProp->SetPointSize(theVal);
myNodeExtProp->SetPointSize(theVal);
myHighlightProp->SetPointSize(theVal);
myPreselectProp->SetPointSize(theVal);
vtkFloatingPointType aPointSize = my0DProp->GetPointSize() > theVal ? my0DProp->GetPointSize() : theVal;
//myHighlightProp->SetPointSize(theVal);
myHighlightProp->SetPointSize(aPointSize); // ??
//myPreselectProp->SetPointSize(theVal);
myPreselectProp->SetPointSize(aPointSize); // ??
my1DProp->SetPointSize(theVal + aPointSizeInc);
my1DExtProp->SetPointSize(theVal + aPointSizeInc);
@ -1593,27 +1692,28 @@ IsImplicitFunctionUsed() const
}
void
SMESH_ActorDef::
SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
{
myNodeActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
myNodeExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my0DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
//my0DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my2DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my2DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my3DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
}
vtkIdType
SMESH_ActorDef::
AddClippingPlane(vtkPlane* thePlane)
SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane)
{
if(thePlane){
myImplicitBoolean->GetFunction()->AddItem(thePlane);

View File

@ -74,7 +74,7 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
enum EReperesent { ePoint, eEdge, eSurface};
enum EEntityMode { eEdges = 0x01, eFaces = 0x02, eVolumes = 0x04, eAllEntity = 0x07};
enum EEntityMode { e0DElements = 0x01, eEdges = 0x02, eFaces = 0x04, eVolumes = 0x08, eAllEntity = 0x0f};
enum EQuadratic2DRepresentation { eLines = 0x01, eArcs = 0x02 };

View File

@ -233,6 +233,11 @@ class SMESH_ActorDef : public SMESH_Actor
vtkProperty* my1DExtProp;
SMESH_DeviceActor* my1DExtActor;
vtkProperty* my0DProp;
SMESH_DeviceActor* my0DActor;
vtkProperty* my0DExtProp;
SMESH_DeviceActor* my0DExtActor;
unsigned int myEntityMode;
unsigned int myEntityState;
bool myIsPointsVisible;

View File

@ -86,6 +86,9 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
{
switch( theType )
{
case SMDSAbs_0DElement:
return VTK_VERTEX;
case SMDSAbs_Edge:
if( theNbNodes == 2 ) return VTK_LINE;
else if ( theNbNodes == 3 ) return VTK_QUADRATIC_EDGE;
@ -295,22 +298,23 @@ void SMESH_VisualObjDef::buildElemPrs()
// Calculate cells size
static SMDSAbs_ElementType aTypes[ 3 ] = { SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
static SMDSAbs_ElementType aTypes[ 4 ] =
{ SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
// get entity data
map<SMDSAbs_ElementType,int> nbEnts;
map<SMDSAbs_ElementType,TEntityList> anEnts;
for ( int i = 0; i <= 2; i++ )
for ( int i = 0; i <= 3; i++ )
nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
// PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead,
// so check remaining memory size for safety
SMDS_Mesh::CheckMemory(); // PAL16631
vtkIdType aCellsSize = 3 * nbEnts[ SMDSAbs_Edge ];
vtkIdType aCellsSize = 2 * nbEnts[ SMDSAbs_0DElement ] + 3 * nbEnts[ SMDSAbs_Edge ];
for ( int i = 1; i <= 2; i++ ) // iterate through faces and volumes
for ( int i = 2; i <= 3; i++ ) // iterate through faces and volumes
{
if ( nbEnts[ aTypes[ i ] ] )
{
@ -321,22 +325,23 @@ void SMESH_VisualObjDef::buildElemPrs()
}
}
vtkIdType aNbCells = nbEnts[ SMDSAbs_Edge ] + nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
vtkIdType aNbCells = nbEnts[ SMDSAbs_0DElement ] + nbEnts[ SMDSAbs_Edge ] +
nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
if ( MYDEBUG )
MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
// Create cells
vtkCellArray* aConnectivity = vtkCellArray::New();
aConnectivity->Allocate( aCellsSize, 0 );
SMDS_Mesh::CheckMemory(); // PAL16631
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents( 1 );
aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
SMDS_Mesh::CheckMemory(); // PAL16631
vtkIdList *anIdList = vtkIdList::New();
@ -347,9 +352,9 @@ void SMESH_VisualObjDef::buildElemPrs()
SMDS_Mesh::CheckMemory(); // PAL16631
for ( int i = 0; i <= 2; i++ ) // iterate through edges, faces and volumes
for ( int i = 0; i <= 3; i++ ) // iterate through 0d elements, edges, faces and volumes
{
if( nbEnts[ aTypes[ i ] ] > 0 )
if ( nbEnts[ aTypes[ i ] ] > 0 )
{
const SMDSAbs_ElementType& aType = aTypes[ i ];
const TEntityList& aList = anEnts[ aType ];
@ -357,7 +362,7 @@ void SMESH_VisualObjDef::buildElemPrs()
for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
{
const SMDS_MeshElement* anElem = *anIter;
vtkIdType aNbNodes = anElem->NbNodes();
anIdList->SetNumberOfIds( aNbNodes );
@ -367,7 +372,7 @@ void SMESH_VisualObjDef::buildElemPrs()
myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
switch(aType){
switch (aType) {
case SMDSAbs_Volume:{
aConnect.clear();
std::vector<int> aConnectivities;
@ -568,6 +573,7 @@ int SMESH_MeshObj::GetElemDimension( const int theObjId )
int aType = anElem->GetType();
switch ( aType )
{
case SMDSAbs_0DElement : return 0;
case SMDSAbs_Edge : return 1;
case SMDSAbs_Face : return 2;
case SMDSAbs_Volume: return 3;
@ -588,6 +594,11 @@ int SMESH_MeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
return myClient->NbNodes();
}
break;
case SMDSAbs_0DElement:
{
return myClient->Nb0DElements();
}
break;
case SMDSAbs_Edge:
{
return myClient->NbEdges();
@ -621,6 +632,12 @@ int SMESH_MeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList&
while ( anIter->more() ) theObjs.push_back( anIter->next() );
}
break;
case SMDSAbs_0DElement:
{
SMDS_0DElementIteratorPtr anIter = myClient->elements0dIterator();
while ( anIter->more() ) theObjs.push_back( anIter->next() );
}
break;
case SMDSAbs_Edge:
{
SMDS_EdgeIteratorPtr anIter = myClient->edgesIterator();
@ -882,6 +899,7 @@ int SMESH_subMeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
return mySubMeshServer->GetNumberOfNodes( false );
}
break;
case SMDSAbs_0DElement:
case SMDSAbs_Edge:
case SMDSAbs_Face:
case SMDSAbs_Volume:

View File

@ -35,6 +35,7 @@ salomeinclude_HEADERS = \
SMDS_ElemIterator.hxx \
SMDS_FacePosition.hxx \
SMDS_Mesh.hxx \
SMDS_Mesh0DElement.hxx \
SMDS_MeshEdge.hxx \
SMDS_MeshElement.hxx \
SMDS_MeshElementIDFactory.hxx \
@ -76,6 +77,7 @@ dist_libSMDS_la_SOURCES = \
SMDS_SpacePosition.cxx \
SMDS_VertexPosition.cxx \
SMDS_MeshNode.cxx \
SMDS_Mesh0DElement.cxx \
SMDS_MeshEdge.cxx \
SMDS_MeshFace.cxx \
SMDS_MeshVolume.cxx \

View File

@ -33,6 +33,7 @@ enum SMDSAbs_ElementType
{
SMDSAbs_All,
SMDSAbs_Node,
SMDSAbs_0DElement,
SMDSAbs_Edge,
SMDSAbs_Face,
SMDSAbs_Volume,

View File

@ -22,9 +22,9 @@
// SMESH SMDS : implementaion of Salome mesh data structure
// File : SMDS_MeshElement.hxx
// Module : SMESH
// Created: 12.01.05 18:02:52
// Author: Michael Sazonov
//
// Created: 12.01.05 18:02:52
// Author: Michael Sazonov
#ifndef SMDS_ElemIterator_HeaderFile
#define SMDS_ElemIterator_HeaderFile
@ -33,6 +33,7 @@
class SMDS_MeshElement;
class SMDS_MeshNode;
class SMDS_Mesh0DElement;
class SMDS_MeshEdge;
class SMDS_MeshFace;
class SMDS_MeshVolume;
@ -43,6 +44,9 @@ typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshElement *> > SMDS_ElemIte
typedef SMDS_Iterator<const SMDS_MeshNode *> SMDS_NodeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshNode *> > SMDS_NodeIteratorPtr;
typedef SMDS_Iterator<const SMDS_Mesh0DElement *> SMDS_0DElementIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_Mesh0DElement *> > SMDS_0DElementIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshEdge *> SMDS_EdgeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshEdge *> > SMDS_EdgeIteratorPtr;

View File

@ -20,7 +20,7 @@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMDS : implementaion of Salome mesh data structure
//
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
@ -166,12 +166,58 @@ SMDS_MeshNode * SMDS_Mesh::AddNodeWithID(double x, double y, double z, int ID)
return NULL;
}
///////////////////////////////////////////////////////////////////////////////
/// create a Mesh0DElement and add it to the current Mesh
/// @return : The created Mesh0DElement
///////////////////////////////////////////////////////////////////////////////
SMDS_Mesh0DElement* SMDS_Mesh::Add0DElementWithID(int idnode, int ID)
{
SMDS_MeshNode * node = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode);
if (!node) return NULL;
return SMDS_Mesh::Add0DElementWithID(node, ID);
}
///////////////////////////////////////////////////////////////////////////////
/// create a Mesh0DElement and add it to the current Mesh
/// @return : The created Mesh0DElement
///////////////////////////////////////////////////////////////////////////////
SMDS_Mesh0DElement* SMDS_Mesh::Add0DElement(const SMDS_MeshNode * node)
{
return SMDS_Mesh::Add0DElementWithID(node, myElementIDFactory->GetFreeID());
}
///////////////////////////////////////////////////////////////////////////////
/// Create a new Mesh0DElement and at it to the mesh
/// @param idnode ID of the node
/// @param ID ID of the 0D element to create
/// @return The created 0D element or NULL if an element with this
/// ID already exists or if input node is not found.
///////////////////////////////////////////////////////////////////////////////
SMDS_Mesh0DElement* SMDS_Mesh::Add0DElementWithID(const SMDS_MeshNode * n, int ID)
{
if (!n) return 0;
if (my0DElements.Extent() % CHECKMEMORY_INTERVAL == 0) CheckMemory();
SMDS_Mesh0DElement * el0d = new SMDS_Mesh0DElement(n);
if (myElementIDFactory->BindID(ID, el0d)) {
SMDS_MeshNode *node = const_cast<SMDS_MeshNode*>(n);
node->AddInverseElement(el0d);
my0DElements.Add(el0d);
myInfo.myNb0DElements++;
return el0d;
}
delete el0d;
return NULL;
}
///////////////////////////////////////////////////////////////////////////////
/// create a MeshEdge and add it to the current Mesh
/// @return : The created MeshEdge
///////////////////////////////////////////////////////////////////////////////
SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID)
SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID)
{
SMDS_MeshNode * node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
SMDS_MeshNode * node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
@ -200,7 +246,7 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode * node1,
///////////////////////////////////////////////////////////////////////////////
SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n2,
int ID)
{
if ( !n1 || !n2 ) return 0;
@ -217,7 +263,7 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
myEdges.Add(edge);
myInfo.myNbEdges++;
return edge;
}
}
else {
delete edge;
return NULL;
@ -284,10 +330,10 @@ SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
/// Add a quadrangle defined by its nodes IDs
///////////////////////////////////////////////////////////////////////////////
SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int idnode1,
int idnode2,
SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int idnode1,
int idnode2,
int idnode3,
int idnode4,
int idnode4,
int ID)
{
SMDS_MeshNode *node1, *node2, *node3, *node4;
@ -400,12 +446,12 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshEdge * e1,
}
///////////////////////////////////////////////////////////////////////////////
///Create a new tetrahedron and add it to the mesh.
///@return The created tetrahedron
///Create a new tetrahedron and add it to the mesh.
///@return The created tetrahedron
///////////////////////////////////////////////////////////////////////////////
SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4)
{
@ -416,16 +462,16 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
}
///////////////////////////////////////////////////////////////////////////////
///Create a new tetrahedron and add it to the mesh.
///Create a new tetrahedron and add it to the mesh.
///@param ID The ID of the new volume
///@return The created tetrahedron or NULL if an element with this ID already exists
///or if input nodes are not found.
///////////////////////////////////////////////////////////////////////////////
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
int idnode2,
int idnode3,
int idnode4,
int idnode3,
int idnode4,
int ID)
{
SMDS_MeshNode *node1, *node2, *node3, *node4;
@ -1121,6 +1167,15 @@ void SMDS_Mesh::RemoveNode(const SMDS_MeshNode * node)
/// Remove an edge and all the elements which own this edge
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::Remove0DElement(const SMDS_Mesh0DElement * elem0d)
{
RemoveElement(elem0d,true);
}
///////////////////////////////////////////////////////////////////////////////
/// Remove an edge and all the elements which own this edge
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge)
{
RemoveElement(edge,true);
@ -1201,6 +1256,11 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * element,
SMDS_MeshElement* elem = const_cast<SMDS_MeshElement*>(element);
switch ( elem->GetType() )
{
case SMDSAbs_0DElement: {
if ( SMDS_Mesh0DElement* elem0d = dynamic_cast<SMDS_Mesh0DElement*>( elem ))
Ok = elem0d->ChangeNode( nodes[0] );
break;
}
case SMDSAbs_Edge: {
if ( nbnodes == 2 ) {
if ( SMDS_MeshEdge* edge = dynamic_cast<SMDS_MeshEdge*>( elem ))
@ -1322,6 +1382,50 @@ bool SMDS_Mesh::ChangePolyhedronNodes (const SMDS_MeshElement * elem,
}
//=======================================================================
//function : Find0DElement
//purpose :
//=======================================================================
const SMDS_Mesh0DElement* SMDS_Mesh::Find0DElement(int idnode) const
{
const SMDS_MeshNode * node = FindNode(idnode);
if(node == NULL) return NULL;
return Find0DElement(node);
}
const SMDS_Mesh0DElement* SMDS_Mesh::Find0DElement(const SMDS_MeshNode * node)
{
if (!node) return 0;
const SMDS_Mesh0DElement* toReturn = NULL;
SMDS_ElemIteratorPtr it1 = node->GetInverseElementIterator(SMDSAbs_0DElement);
while (it1->more() && (toReturn == NULL)) {
const SMDS_MeshElement* e = it1->next();
if (e->NbNodes() == 1) {
toReturn = static_cast<const SMDS_Mesh0DElement*>(e);
}
}
return toReturn;
}
//=======================================================================
//function : Find0DElementOrCreate
//purpose :
//=======================================================================
SMDS_Mesh0DElement* SMDS_Mesh::Find0DElementOrCreate(const SMDS_MeshNode * node)
{
if (!node) return 0;
SMDS_Mesh0DElement * toReturn = NULL;
toReturn = const_cast<SMDS_Mesh0DElement*>(Find0DElement(node));
if (toReturn == NULL) {
if (my0DElements.Extent() % CHECKMEMORY_INTERVAL == 0) CheckMemory();
toReturn = new SMDS_Mesh0DElement(node);
my0DElements.Add(toReturn);
myInfo.myNb0DElements++;
}
return toReturn;
}
//=======================================================================
//function : FindEdge
//purpose :
@ -1666,6 +1770,7 @@ const SMDS_MeshFace* SMDS_Mesh::FindFace (std::vector<int> nodes_ids) const
for (int inode = 0; inode < nbnodes; inode++) {
const SMDS_MeshNode * node = FindNode(nodes_ids[inode]);
if (node == NULL) return NULL;
poly_nodes[inode] = node;
}
return FindFace(poly_nodes);
}
@ -1704,6 +1809,17 @@ void SMDS_Mesh::DumpNodes() const
while(itnode->more()) MESSAGE(itnode->next());
}
//=======================================================================
//function : Dump0DElements
//purpose :
//=======================================================================
void SMDS_Mesh::Dump0DElements() const
{
MESSAGE("dump 0D elements of mesh : ");
SMDS_0DElementIteratorPtr it0d = elements0dIterator();
while(it0d->more()) MESSAGE(it0d->next());
}
//=======================================================================
//function : DumpEdges
//purpose :
@ -1750,6 +1866,7 @@ void SMDS_Mesh::DebugStats() const
MESSAGE("Debug stats of mesh : ");
MESSAGE("===== NODES ====="<<NbNodes());
MESSAGE("===== 0DELEMS ====="<<Nb0DElements());
MESSAGE("===== EDGES ====="<<NbEdges());
MESSAGE("===== FACES ====="<<NbFaces());
MESSAGE("===== VOLUMES ====="<<NbVolumes());
@ -1798,6 +1915,14 @@ int SMDS_Mesh::NbNodes() const
return myNodes.Size();
}
///////////////////////////////////////////////////////////////////////////////
/// Return the number of 0D elements
///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::Nb0DElements() const
{
return my0DElements.Size();
}
///////////////////////////////////////////////////////////////////////////////
/// Return the number of edges (including construction edges)
///////////////////////////////////////////////////////////////////////////////
@ -1859,10 +1984,18 @@ SMDS_Mesh::~SMDS_Mesh()
while (itn->more())
myNodeIDFactory->ReleaseID(itn->next()->GetID());
}
SetOfNodes::Iterator itn(myNodes);
for (; itn.More(); itn.Next())
delete itn.Value();
SetOf0DElements::Iterator it0d (my0DElements);
for (; it0d.More(); it0d.Next())
{
SMDS_MeshElement* elem = it0d.Value();
delete elem;
}
SetOfEdges::Iterator ite(myEdges);
for (; ite.More(); ite.Next())
{
@ -1883,7 +2016,6 @@ SMDS_Mesh::~SMDS_Mesh()
SMDS_MeshElement* elem = itv.Value();
delete elem;
}
}
//================================================================================
@ -1921,6 +2053,11 @@ void SMDS_Mesh::Clear()
delete ite->next();
myEdges.Clear();
SMDS_0DElementIteratorPtr it0d = elements0dIterator();
while (it0d->more())
delete it0d->next();
my0DElements.Clear();
SMDS_NodeIteratorPtr itn = nodesIterator();
while (itn->more())
delete itn->next();
@ -2048,6 +2185,17 @@ struct MYNCollection_Map_Iterator: public FATHER
}
};
///////////////////////////////////////////////////////////////////////////////
///Return an iterator on 0D elements of the current mesh.
///////////////////////////////////////////////////////////////////////////////
SMDS_0DElementIteratorPtr SMDS_Mesh::elements0dIterator() const
{
typedef MYNCollection_Map_Iterator
< SetOf0DElements, const SMDS_Mesh0DElement*, SMDS_0DElementIterator > TIterator;
return SMDS_0DElementIteratorPtr(new TIterator(my0DElements));
}
///////////////////////////////////////////////////////////////////////////////
///Return an iterator on edges of the current mesh.
///////////////////////////////////////////////////////////////////////////////
@ -2095,6 +2243,8 @@ SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator(SMDSAbs_ElementType type) const
return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOfFaces >(myFaces));
case SMDSAbs_Edge:
return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOfEdges >(myEdges));
case SMDSAbs_0DElement:
return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOf0DElements >(my0DElements));
case SMDSAbs_Node:
return myNodeIDFactory->elementsIterator();
default:;
@ -2184,16 +2334,20 @@ static set<const SMDS_MeshElement*> * getExclusiveNodes(
///@param element The element were to search matching children
///@param nodes The nodes that the children must have to be selected
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
const SMDS_MeshElement * element, set<const SMDS_MeshElement*>& nodes)
void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
const SMDS_MeshElement * element,
set<const SMDS_MeshElement*>& nodes)
{
switch(element->GetType())
{
case SMDSAbs_Node:
MESSAGE("Internal Error: This should not append");
break;
case SMDSAbs_Edge:
switch(element->GetType())
{
case SMDSAbs_Node:
MESSAGE("Internal Error: This should not happend");
break;
case SMDSAbs_0DElement:
{
}
break;
case SMDSAbs_Edge:
{
SMDS_ElemIteratorPtr itn=element->nodesIterator();
while(itn->more())
@ -2206,7 +2360,7 @@ void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren
}
}
} break;
case SMDSAbs_Face:
case SMDSAbs_Face:
{
SMDS_ElemIteratorPtr itn=element->nodesIterator();
while(itn->more())
@ -2225,7 +2379,7 @@ void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
}
} break;
case SMDSAbs_Volume:
case SMDSAbs_Volume:
{
if(hasConstructionFaces())
{
@ -2240,7 +2394,7 @@ void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
}
}
}
}
}
///////////////////////////////////////////////////////////////////////////////
@ -2248,7 +2402,7 @@ void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren
///@param removenodes if true remaining nodes will be removed
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
const bool removenodes)
const bool removenodes)
{
list<const SMDS_MeshElement *> removedElems;
list<const SMDS_MeshElement *> removedNodes;
@ -2268,8 +2422,9 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
{
// get finite elements built on elem
set<const SMDS_MeshElement*> * s1;
if (!hasConstructionEdges() && elem->GetType() == SMDSAbs_Edge ||
!hasConstructionFaces() && elem->GetType() == SMDSAbs_Face ||
if (elem->GetType() == SMDSAbs_0DElement ||
elem->GetType() == SMDSAbs_Edge && !hasConstructionEdges() ||
elem->GetType() == SMDSAbs_Face && !hasConstructionFaces() ||
elem->GetType() == SMDSAbs_Volume)
{
s1 = new set<const SMDS_MeshElement*>();
@ -2319,6 +2474,12 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
case SMDSAbs_Node:
MESSAGE("Internal Error: This should not happen");
break;
case SMDSAbs_0DElement:
my0DElements.Remove(static_cast<SMDS_Mesh0DElement*>
(const_cast<SMDS_MeshElement*>(*it)));
//myInfo.Remove0DElement(*it);
myInfo.remove(*it);
break;
case SMDSAbs_Edge:
myEdges.Remove(static_cast<SMDS_MeshEdge*>
(const_cast<SMDS_MeshElement*>(*it)));
@ -2395,6 +2556,12 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
// in meshes without descendants elements are always free
switch (aType) {
case SMDSAbs_0DElement:
my0DElements.Remove(static_cast<SMDS_Mesh0DElement*>
(const_cast<SMDS_MeshElement*>(elem)));
//myInfo.Remove0DElement(elem);
myInfo.remove(elem);
break;
case SMDSAbs_Edge:
myEdges.Remove(static_cast<SMDS_MeshEdge*>
(const_cast<SMDS_MeshElement*>(elem)));
@ -2430,6 +2597,10 @@ bool SMDS_Mesh::Contains (const SMDS_MeshElement* elem) const
while (itn->more())
if (elem == itn->next())
return true;
SMDS_0DElementIteratorPtr it0d = elements0dIterator();
while (it0d->more())
if (elem == it0d->next())
return true;
SMDS_EdgeIteratorPtr ite = edgesIterator();
while (ite->more())
if (elem == ite->next())

View File

@ -22,13 +22,14 @@
// SMESH SMDS : implementaion of Salome mesh data structure
// File : SMDS_Mesh.hxx
// Module : SMESH
//
#ifndef _SMDS_Mesh_HeaderFile
#define _SMDS_Mesh_HeaderFile
#include "SMESH_SMDS.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMDS_Mesh0DElement.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
@ -43,34 +44,39 @@
class SMDS_EXPORT SMDS_Mesh:public SMDS_MeshObject{
public:
SMDS_Mesh();
SMDS_NodeIteratorPtr nodesIterator() const;
SMDS_0DElementIteratorPtr elements0dIterator() const;
SMDS_EdgeIteratorPtr edgesIterator() const;
SMDS_FaceIteratorPtr facesIterator() const;
SMDS_VolumeIteratorPtr volumesIterator() const;
SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
SMDSAbs_ElementType GetElementType( const int id, const bool iselem ) const;
SMDS_Mesh *AddSubMesh();
virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
virtual SMDS_MeshNode* AddNode(double x, double y, double z);
virtual SMDS_Mesh0DElement* Add0DElementWithID(int n, int ID);
virtual SMDS_Mesh0DElement* Add0DElementWithID(const SMDS_MeshNode * n, int ID);
virtual SMDS_Mesh0DElement* Add0DElement (const SMDS_MeshNode * n);
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n2,
int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
// 2d order edge with 3 nodes: n12 - node between n1 and n2
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12,
int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -79,23 +85,23 @@ public:
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n3,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n4,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshEdge * e1,
const SMDS_MeshEdge * e2,
const SMDS_MeshEdge * e3, int ID);
@ -117,10 +123,10 @@ public:
int n12,int n23,int n31, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n31,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -135,11 +141,11 @@ public:
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n41,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -154,27 +160,27 @@ public:
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n4,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n5,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
@ -182,7 +188,7 @@ public:
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n6,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -190,7 +196,7 @@ public:
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int n7, int n8, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
@ -200,7 +206,7 @@ public:
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n8,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -251,13 +257,13 @@ public:
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n34,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -266,7 +272,7 @@ public:
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34);
@ -279,15 +285,15 @@ public:
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n45,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -297,7 +303,7 @@ public:
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
@ -315,29 +321,29 @@ public:
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36,
const SMDS_MeshNode * n36,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36);
@ -356,19 +362,19 @@ public:
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
const SMDS_MeshNode * n48,
const SMDS_MeshNode * n48,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -377,15 +383,15 @@ public:
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
@ -419,6 +425,7 @@ public:
const bool removenodes = false);
virtual void RemoveElement(const SMDS_MeshElement * elem, bool removenodes = false);
virtual void RemoveNode(const SMDS_MeshNode * node);
virtual void Remove0DElement(const SMDS_Mesh0DElement * elem0d);
virtual void RemoveEdge(const SMDS_MeshEdge * edge);
virtual void RemoveFace(const SMDS_MeshFace * face);
virtual void RemoveVolume(const SMDS_MeshVolume * volume);
@ -430,7 +437,7 @@ public:
virtual void RemoveFreeElement(const SMDS_MeshElement * elem);
virtual void Clear();
virtual bool RemoveFromParent();
virtual bool RemoveSubMesh(const SMDS_Mesh * aMesh);
@ -445,6 +452,7 @@ public:
// Renumber all nodes or elements.
const SMDS_MeshNode *FindNode(int idnode) const;
const SMDS_Mesh0DElement* Find0DElement(int idnode) const;
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2, int idnode3) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const;
@ -454,6 +462,7 @@ public:
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4,
int idnode5, int idnode6, int idnode7, int idnode8) const;
const SMDS_MeshElement *FindElement(int IDelem) const;
static const SMDS_Mesh0DElement* Find0DElement(const SMDS_MeshNode * n);
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
@ -499,11 +508,13 @@ public:
const SMDS_MeshInfo& GetMeshInfo() const { return myInfo; }
int NbNodes() const;
int Nb0DElements() const;
int NbEdges() const;
int NbFaces() const;
int NbVolumes() const;
int NbSubMesh() const;
void DumpNodes() const;
void Dump0DElements() const;
void DumpEdges() const;
void DumpFaces() const;
void DumpVolumes() const;
@ -527,6 +538,7 @@ public:
bool Contains (const SMDS_MeshElement* elem) const;
typedef NCollection_Map<SMDS_MeshNode *> SetOfNodes;
typedef NCollection_Map<SMDS_Mesh0DElement *> SetOf0DElements;
typedef NCollection_Map<SMDS_MeshEdge *> SetOfEdges;
typedef NCollection_Map<SMDS_MeshFace *> SetOfFaces;
typedef NCollection_Map<SMDS_MeshVolume *> SetOfVolumes;
@ -534,13 +546,14 @@ public:
private:
SMDS_Mesh(SMDS_Mesh * parent);
SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3);
SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4);
SMDS_Mesh0DElement* Find0DElementOrCreate(const SMDS_MeshNode * n);
SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
@ -553,13 +566,14 @@ private:
bool registerElement(int ID, SMDS_MeshElement * element);
void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren,
const SMDS_MeshElement * element,
void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren,
const SMDS_MeshElement * element,
std::set<const SMDS_MeshElement*>& nodes);
// Fields PRIVATE
SetOfNodes myNodes;
SetOf0DElements my0DElements;
SetOfEdges myEdges;
SetOfFaces myFaces;
SetOfVolumes myVolumes;

View File

@ -0,0 +1,155 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMDS : implementaion of Salome mesh data structure
// File : SMDS_Mesh0DElement.cxx
// Author : Jean-Michel BOULCOURT
// Module : SMESH
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_Mesh0DElement.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
using namespace std;
//=======================================================================
//function : SMDS_Mesh0DElement
//purpose :
//=======================================================================
SMDS_Mesh0DElement::SMDS_Mesh0DElement (const SMDS_MeshNode * node)
{
myNode = node;
}
//=======================================================================
//function : Print
//purpose :
//=======================================================================
void SMDS_Mesh0DElement::Print (ostream & OS) const
{
OS << "0D Element <" << GetID() << "> : (" << myNode << ") " << endl;
}
//=======================================================================
//function : NbNodes
//purpose :
//=======================================================================
int SMDS_Mesh0DElement::NbNodes() const
{
return 1;
}
//=======================================================================
//function : NbEdges
//purpose :
//=======================================================================
int SMDS_Mesh0DElement::NbEdges() const
{
return 0;
}
//=======================================================================
//function : GetType
//purpose :
//=======================================================================
SMDSAbs_ElementType SMDS_Mesh0DElement::GetType() const
{
return SMDSAbs_0DElement;
}
//=======================================================================
//function : elementsIterator
//purpose :
//=======================================================================
class SMDS_Mesh0DElement_MyNodeIterator: public SMDS_ElemIterator
{
const SMDS_MeshNode * myNode;
int myIndex;
public:
SMDS_Mesh0DElement_MyNodeIterator(const SMDS_MeshNode * node):
myNode(node),myIndex(0) {}
bool more()
{
return myIndex < 1;
}
const SMDS_MeshElement* next()
{
myIndex++;
if (myIndex == 1)
return myNode;
return NULL;
}
};
SMDS_ElemIteratorPtr SMDS_Mesh0DElement::elementsIterator (SMDSAbs_ElementType type) const
{
switch(type)
{
case SMDSAbs_0DElement:
return SMDS_MeshElement::elementsIterator(SMDSAbs_0DElement);
case SMDSAbs_Node:
return SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode));
default:
return SMDS_ElemIteratorPtr
(new SMDS_IteratorOfElements
(this,type, SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode))));
}
}
//=======================================================================
//function : operator<
//purpose :
//=======================================================================
bool operator< (const SMDS_Mesh0DElement & e1, const SMDS_Mesh0DElement & e2)
{
int id1 = e1.myNode->GetID();
int id2 = e2.myNode->GetID();
return (id1 < id2);
}
/*!
* \brief Return node by its index
* \param ind - node index
* \retval const SMDS_MeshNode* - the node
*/
const SMDS_MeshNode* SMDS_Mesh0DElement::GetNode(const int ind) const
{
if (ind == 0)
return myNode;
return NULL;
}
//=======================================================================
//function : ChangeNode
//purpose :
//=======================================================================
bool SMDS_Mesh0DElement::ChangeNode (const SMDS_MeshNode * node)
{
myNode = node;
return true;
}

View File

@ -0,0 +1,61 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMDS : implementaion of Salome mesh data structure
// File : SMDS_Mesh0DElement.hxx
// Module : SMESH
#ifndef _SMDS_Mesh0DElement_HeaderFile
#define _SMDS_Mesh0DElement_HeaderFile
#include "SMESH_SMDS.hxx"
#include "SMDS_MeshElement.hxx"
#include <iostream>
class SMDS_EXPORT SMDS_Mesh0DElement: public SMDS_MeshElement
{
public:
SMDS_Mesh0DElement (const SMDS_MeshNode * node);
bool ChangeNode (const SMDS_MeshNode * node);
void Print (std::ostream & OS) const;
SMDSAbs_ElementType GetType() const;
int NbNodes() const;
int NbEdges() const;
friend bool operator< (const SMDS_Mesh0DElement& e1, const SMDS_Mesh0DElement& e2);
/*!
* \brief Return node by its index
* \param ind - node index
* \retval const SMDS_MeshNode* - the node
*/
virtual const SMDS_MeshNode* GetNode (const int ind) const;
protected:
SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
protected:
const SMDS_MeshNode* myNode;
};
#endif

View File

@ -42,6 +42,7 @@ public:
int NbNodes() const { return myNbNodes; }
inline int NbElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
int Nb0DElements() const { return myNb0DElements; }
inline int NbEdges (SMDSAbs_ElementOrder order = ORDER_ANY) const;
inline int NbFaces (SMDSAbs_ElementOrder order = ORDER_ANY) const;
inline int NbTriangles (SMDSAbs_ElementOrder order = ORDER_ANY) const;
@ -69,6 +70,7 @@ private:
int myNbNodes;
int myNb0DElements;
int myNbEdges , myNbQuadEdges ;
int myNbTriangles , myNbQuadTriangles ;
int myNbQuadrangles, myNbQuadQuadrangles;
@ -86,6 +88,7 @@ private:
inline SMDS_MeshInfo::SMDS_MeshInfo():
myNbNodes(0),
myNb0DElements(0),
myNbEdges (0), myNbQuadEdges (0),
myNbTriangles (0), myNbQuadTriangles (0),
myNbQuadrangles(0), myNbQuadQuadrangles(0),
@ -97,30 +100,30 @@ inline SMDS_MeshInfo::SMDS_MeshInfo():
myNbPolyhedrons(0)
{
// Number of nodes in standard element types
// n v f e
// o o a d
// n v f e 0
// o o a d d
// d l c g
// e e e
// -----------
// 1
// --------------
// 1 *
// 2 *
// 3 *
// 4 * * *
// 5 *
// 5 *
// 6 * *
// 7
// 7
// 8 * *
// 9
// 10 *
// 11
// 12
// 13 *
// 14
// 15 *
// 16
// 17
// 18
// 19
// 9
// 10 *
// 11
// 12
// 13 *
// 14
// 15 *
// 16
// 17
// 18
// 19
// 20 *
//
// So to have a unique index for each type basing on nb of nodes, we use a shift:
@ -131,6 +134,8 @@ inline SMDS_MeshInfo::SMDS_MeshInfo():
myNb.resize( index( SMDSAbs_Volume,20 ) + 1, NULL);
myNb[ index( SMDSAbs_Node,1 )] = & myNbNodes;
myNb[ index( SMDSAbs_0DElement,1 )] = & myNb0DElements;
myNb[ index( SMDSAbs_Edge,2 )] = & myNbEdges;
myNb[ index( SMDSAbs_Edge,4 )] = & myNbQuadEdges;

View File

@ -1192,6 +1192,18 @@ int SMESH_Mesh::NbNodes() throw(SALOME_Exception)
*/
//================================================================================
int SMESH_Mesh::Nb0DElements() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
return _myMeshDS->GetMeshInfo().Nb0DElements();
}
//================================================================================
/*!
* \brief Return number of edges of given order in the mesh
*/
//================================================================================
int SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);

View File

@ -202,6 +202,8 @@ public:
int NbNodes() throw(SALOME_Exception);
int Nb0DElements() throw(SALOME_Exception);
int NbEdges(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
int NbFaces(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);

View File

@ -103,6 +103,28 @@ namespace
}
//=======================================================================
//function : Add0DElementsWithID
//=======================================================================
inline void Add0DElementsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if (2*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddEdgeWithID - 2*aNbElems != aCoords.length()");
CORBA::Long anIndexId = 0;
for (; anElemId < aNbElems; anElemId++, anIndexId+=2)
{
SMDS_MeshElement* anElem = theMesh->Add0DElementWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId]);
if (!anElem)
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot Add0DElementWithID for ID = "<<anElemId);
}
}
//=======================================================================
//function : AddEdgesWithID
//=======================================================================
@ -708,6 +730,7 @@ SMESH_Client::Update(bool theIsClear)
switch(aCommand)
{
case SMESH::ADD_NODE : AddNodesWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_ELEM0D : Add0DElementsWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_EDGE : AddEdgesWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_TRIANGLE : AddTriasWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_QUADRANGLE : AddQuadsWithID ( mySMDSMesh, aSeq, anId ); break;
@ -796,6 +819,7 @@ SMESH_Client::Update(bool theIsClear)
if ( MYDEBUG && mySMDSMesh )
{
MESSAGE("Update - mySMDSMesh->NbNodes() = "<<mySMDSMesh->NbNodes());
MESSAGE("Update - mySMDSMesh->Nb0DElements() = "<<mySMDSMesh->Nb0DElements());
MESSAGE("Update - mySMDSMesh->NbEdges() = "<<mySMDSMesh->NbEdges());
MESSAGE("Update - mySMDSMesh->NbFaces() = "<<mySMDSMesh->NbFaces());
MESSAGE("Update - mySMDSMesh->NbVolumes() = "<<mySMDSMesh->NbVolumes());

View File

@ -84,6 +84,22 @@ void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z)
myNumber++;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void SMESHDS_Command::Add0DElement(int New0DElementID, int idnode)
{
if (!myType == SMESHDS_Add0DElement)
{
MESSAGE("SMESHDS_Command::Add0DElement : Bad Type");
return;
}
myIntegers.push_back(New0DElementID);
myIntegers.push_back(idnode);
myNumber++;
}
//=======================================================================
//function :
//purpose :

View File

@ -38,6 +38,7 @@ class SMESHDS_EXPORT SMESHDS_Command
public:
SMESHDS_Command(const SMESHDS_CommandType aType);
void AddNode(int NewNodeID, double x, double y, double z);
void Add0DElement(int New0DElementID, int idnode);
void AddEdge(int NewEdgeID, int idnode1, int idnode2);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3,

View File

@ -30,6 +30,7 @@
enum SMESHDS_CommandType {
SMESHDS_AddNode,
SMESHDS_Add0DElement,
SMESHDS_AddEdge,
SMESHDS_AddTriangle,
SMESHDS_AddQuadrangle,

View File

@ -248,6 +248,30 @@ void SMESHDS_Mesh::Renumber (const bool isNodes, const int startID, const int de
myScript->Renumber( isNodes, startID, deltaID );
}
//=======================================================================
//function : Add0DElement
//purpose :
//=======================================================================
SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElementWithID(int nodeID, int ID)
{
SMDS_Mesh0DElement* anElem = SMDS_Mesh::Add0DElementWithID(nodeID, ID);
if (anElem) myScript->Add0DElement(ID, nodeID);
return anElem;
}
SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElementWithID
(const SMDS_MeshNode * node, int ID)
{
return Add0DElementWithID(node->GetID(), ID);
}
SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElement(const SMDS_MeshNode * node)
{
SMDS_Mesh0DElement* anElem = SMDS_Mesh::Add0DElement(node);
if (anElem) myScript->Add0DElement(anElem->GetID(), node->GetID());
return anElem;
}
//=======================================================================
//function :AddEdgeWithID
//purpose :

View File

@ -30,6 +30,7 @@
#include "SMDS_Mesh.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMDS_Mesh0DElement.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
@ -66,7 +67,11 @@ public:
bool RemoveHypothesis(const TopoDS_Shape & S, const SMESHDS_Hypothesis * H);
virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
virtual SMDS_MeshNode * AddNode(double x, double y, double z);
virtual SMDS_MeshNode* AddNode(double x, double y, double z);
virtual SMDS_Mesh0DElement* Add0DElementWithID(int nodeID, int ID);
virtual SMDS_Mesh0DElement* Add0DElementWithID(const SMDS_MeshNode * node, int ID);
virtual SMDS_Mesh0DElement* Add0DElement (const SMDS_MeshNode * node);
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,

View File

@ -95,6 +95,19 @@ void SMESHDS_Script::AddNode(int NewNodeID, double x, double y, double z)
getCommand(SMESHDS_AddNode)->AddNode(NewNodeID, x, y, z);
}
//=======================================================================
//function :
//purpose :
//=======================================================================
void SMESHDS_Script::Add0DElement (int New0DElementID, int idnode)
{
if (myIsEmbeddedMode) {
myIsModified = true;
return;
}
getCommand(SMESHDS_Add0DElement)->Add0DElement(New0DElementID, idnode);
}
//=======================================================================
//function :
//purpose :

View File

@ -44,6 +44,7 @@ class SMESHDS_EXPORT SMESHDS_Script
bool IsModified();
void AddNode(int NewNodeID, double x, double y, double z);
void Add0DElement(int New0DElementID, int idnode);
void AddEdge(int NewEdgeID, int idnode1, int idnode2);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3,

View File

@ -508,6 +508,9 @@
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
unsigned int aMode = anActor->GetEntityMode();
switch(theCommandID){
case 216:
InverseEntityMode(aMode,SMESH_Actor::e0DElements);
break;
case 217:
InverseEntityMode(aMode,SMESH_Actor::eEdges);
break;
@ -1467,6 +1470,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break;
// Display Entity
case 216: // 0D elements
case 217: // Edges
case 218: // Faces
case 219: // Volumes
@ -1571,7 +1575,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break;
}
case 400: // NODES
case 4000: // NODES
{
if(checkLock(aStudy)) break;
@ -2192,7 +2196,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break;
}
case 401: // GEOM::EDGE
case 4009: // ELEM0D
case 4010: // GEOM::EDGE
case 4021: // TRIANGLE
case 4022: // QUAD
case 4023: // POLYGON
@ -2205,6 +2210,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
SMDSAbs_ElementType type = SMDSAbs_Edge;
int nbNodes = 2;
switch (theCommandID) {
case 4009: // ELEM0D
type = SMDSAbs_0DElement; nbNodes = 1; break;
case 4021: // TRIANGLE
type = SMDSAbs_Face; nbNodes = 3; break;
case 4022: // QUAD
@ -2729,8 +2736,9 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 6018, "LENGTH_2D", "ICON_LENGTH_2D", 0, true );
createSMESHAction( 6019, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true );
createSMESHAction( 6009, "VOLUME_3D", "ICON_VOLUME_3D", 0, true );
createSMESHAction( 400, "NODE", "ICON_DLG_NODE" );
createSMESHAction( 401, "EDGE", "ICON_DLG_EDGE" );
createSMESHAction( 4000, "NODE", "ICON_DLG_NODE" );
createSMESHAction( 4009, "ELEM0D", "ICON_DLG_ELEM0D" );
createSMESHAction( 4010, "EDGE", "ICON_DLG_EDGE" );
createSMESHAction( 4021, "TRIANGLE", "ICON_DLG_TRIANGLE" );
createSMESHAction( 4022, "QUAD", "ICON_DLG_QUADRANGLE" );
createSMESHAction( 4023, "POLYGON", "ICON_DLG_POLYGON" );
@ -2767,6 +2775,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 213, "SHRINK", "ICON_SHRINK", 0, true );
createSMESHAction( 214, "UPDATE", "ICON_UPDATE" );
createSMESHAction( 215, "NODES", "ICON_POINTS", 0, true );
createSMESHAction( 216, "ELEMS0D", "ICON_DLG_ELEM0D", 0, true );
createSMESHAction( 217, "EDGES", "ICON_DLG_EDGE", 0, true );
createSMESHAction( 218, "FACES", "ICON_DLG_TRIANGLE", 0, true );
createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
@ -2883,8 +2892,9 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 6021, ctrlId, -1 );
createMenu( separator(), ctrlId, -1 );
createMenu( 400, addId, -1 );
createMenu( 401, addId, -1 );
createMenu( 4000, addId, -1 );
createMenu( 4009, addId, -1 );
createMenu( 4010, addId, -1 );
createMenu( 4021, addId, -1 );
createMenu( 4022, addId, -1 );
createMenu( 4023, addId, -1 );
@ -2977,8 +2987,9 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( 6021, ctrlTb );
createTool( separator(), ctrlTb );
createTool( 400, addRemTb );
createTool( 401, addRemTb );
createTool( 4000, addRemTb );
createTool( 4009, addRemTb );
createTool( 4010, addRemTb );
createTool( 4021, addRemTb );
createTool( 4022, addRemTb );
createTool( 4023, addRemTb );
@ -3111,6 +3122,7 @@ void SMESHGUI::initialize( CAM_Application* app )
hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
hasElems("(count( elemTypes ) > 0)"),
hasDifferentElems("(count( elemTypes ) > 1)"),
hasElems0d("({'Elem0d'} in elemTypes)"),
hasEdges("({'Edge'} in elemTypes)"),
hasFaces("({'Face'} in elemTypes)"),
hasVolumes("({'Volume'} in elemTypes)");
@ -3169,6 +3181,10 @@ void SMESHGUI::initialize( CAM_Application* app )
anId = popupMgr()->insert( tr( "MEN_DISP_ENT" ), -1, -1 );
popupMgr()->insert( action(216), anId, -1 ); // ELEMS 0D
popupMgr()->setRule(action(216), aDiffElemsInVTK + "&& isVisible &&" + hasElems0d, QtxPopupMgr::VisibleRule);
popupMgr()->setRule(action(216), "{'Elem0d'} in entityMode", QtxPopupMgr::ToggleRule);
popupMgr()->insert( action( 217 ), anId, -1 ); // EDGES
popupMgr()->setRule( action( 217 ), aDiffElemsInVTK + "&& isVisible &&" + hasEdges, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 217 ), "{'Edge'} in entityMode", QtxPopupMgr::ToggleRule );
@ -3580,17 +3596,29 @@ void SMESHGUI::createPreferences()
int elemGroup = addPreference( tr( "PREF_GROUP_ELEMENTS" ), meshTab );
setPreferenceProperty( elemGroup, "columns", 2 );
addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::Color, "SMESH", "fill_color" );
addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::Color, "SMESH", "fill_color" );
addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
addPreference( tr( "PREF_BACKFACE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "backface_color" );
addPreference( tr( "PREF_COLOR_0D" ), elemGroup, LightApp_Preferences::Color, "SMESH", "elem0d_color" );
//int sp = addPreference( "", elemGroup, LightApp_Preferences::Space );
//setPreferenceProperty( sp, "hstretch", 0 );
//setPreferenceProperty( sp, "vstretch", 0 );
int size0d = addPreference(tr("PREF_SIZE_0D"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
int sp = addPreference( "", elemGroup, LightApp_Preferences::Space );
int elemW = addPreference(tr("PREF_WIDTH"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "element_width");
int shrink = addPreference(tr("PREF_SHRINK_COEFF"), elemGroup,
LightApp_Preferences::IntSpin, "SMESH", "shrink_coeff");
setPreferenceProperty( size0d, "min", 1 );
setPreferenceProperty( size0d, "max", 10 );
setPreferenceProperty( sp, "hstretch", 0 );
setPreferenceProperty( sp, "vstretch", 0 );
int elemW = addPreference( tr( "PREF_WIDTH" ), elemGroup, LightApp_Preferences::IntSpin, "SMESH", "element_width" );
int shrink = addPreference( tr( "PREF_SHRINK_COEFF" ), elemGroup, LightApp_Preferences::IntSpin, "SMESH", "shrink_coeff" );
setPreferenceProperty( elemW, "min", 1 );
setPreferenceProperty( elemW, "max", 5 );

View File

@ -22,8 +22,8 @@
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_AddMeshElementDlg.cxx
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_AddMeshElementDlg.h"
#include "SMESHGUI.h"
@ -236,7 +236,7 @@ namespace SMESH
// purpose : constructor
//=================================================================================
SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
SMDSAbs_ElementType ElementType,
SMDSAbs_ElementType ElementType,
int nbNodes )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
@ -255,6 +255,10 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
myNbNodes = nbNodes;
myElementType = ElementType;
switch (ElementType) {
case SMDSAbs_0DElement:
if (myNbNodes != 1)
myNbNodes = 1;
break;
case SMDSAbs_Face:
// if (myNbNodes != 3 && myNbNodes != 4)
// myNbNodes = 3;
@ -269,7 +273,11 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
}
QString elemName;
if (myNbNodes == 2) {
if (myNbNodes == 1) {
elemName = "ELEM0D";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_0delems_anchor";
}
else if (myNbNodes == 2) {
elemName = "EDGE";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_edges_anchor";
}
@ -277,7 +285,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
elemName = "TRIANGLE";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_triangles_anchor";
}
else if (myNbNodes == 4)
else if (myNbNodes == 4) {
if (myElementType == SMDSAbs_Face) {
elemName = "QUADRANGLE";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_quadrangles_anchor";
@ -286,6 +294,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
elemName = "TETRAS";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_tetrahedrons_anchor";
}
}
else if (myNbNodes == 8) {
elemName = "HEXAS";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_hexahedrons_anchor";
@ -298,7 +307,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
else if (myElementType == SMDSAbs_Volume) {
myHelpFileName = "adding_nodes_and_elements_page.html#adding_polyhedrons_anchor";
}
QString iconName = tr(QString("ICON_DLG_%1").arg(elemName).toLatin1().data());
QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName).toLatin1().data());
QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName).toLatin1().data());
@ -439,30 +448,31 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
{
if (myNbOkNodes && !mySMESHGUI->isActiveStudyLocked()) {
myBusy = true;
SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
anArrayOfIdeces->length(myNbNodes);
SMESH::long_array_var anArrayOfIndices = new SMESH::long_array;
anArrayOfIndices->length(myNbNodes);
bool reverse = (Reverse && Reverse->isChecked());
QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++)
if (reverse)
anArrayOfIdeces[i] = aListId[ myNbNodes - i - 1 ].toInt();
anArrayOfIndices[i] = aListId[ myNbNodes - i - 1 ].toInt();
else
anArrayOfIdeces[i] = aListId[ i ].toInt();
anArrayOfIndices[i] = aListId[ i ].toInt();
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
switch (myElementType) {
case SMDSAbs_0DElement:
aMeshEditor->Add0DElement(anArrayOfIndices[0]); break;
case SMDSAbs_Edge:
aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
case SMDSAbs_Face:{
aMeshEditor->AddEdge(anArrayOfIndices.inout()); break;
case SMDSAbs_Face: {
if(myIsPoly)
aMeshEditor->AddPolygonalFace(anArrayOfIdeces.inout());
aMeshEditor->AddPolygonalFace(anArrayOfIndices.inout());
else
aMeshEditor->AddFace(anArrayOfIdeces.inout());
aMeshEditor->AddFace(anArrayOfIndices.inout());
break;
}
case SMDSAbs_Volume:
aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
aMeshEditor->AddVolume(anArrayOfIndices.inout()); break;
default:;
}
@ -515,8 +525,9 @@ void SMESHGUI_AddMeshElementDlg::ClickOnCancel()
void SMESHGUI_AddMeshElementDlg::ClickOnHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""),
myHelpFileName);
else {
QString platform;
#ifdef WIN32
@ -526,7 +537,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnHelp()
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser",
arg(app->resourceMgr()->stringValue("ExternalBrowser",
platform)).
arg(myHelpFileName));
}
@ -555,7 +566,7 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
if (aMesh) {
TColStd_MapOfInteger newIndices;
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
bool allOk = true;
for (int i = 0; i < aListId.count(); i++) {
@ -567,13 +578,13 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
else
allOk = false;
}
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight( myActor->getIO(), true, true );
myNbOkNodes = ( allOk && myNbNodes == aListId.count() );
if (myIsPoly)
{
if ( !allOk || myElementType != SMDSAbs_Face || aListId.count() < 3 )
@ -582,13 +593,13 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
myNbOkNodes = aListId.count();
}
}
if(myNbOkNodes) {
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
displaySimulation();
}
myBusy = false;
}
@ -795,7 +806,7 @@ void SMESHGUI_AddMeshElementDlg::keyPressEvent( QKeyEvent* e )
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
if ( e->key() == Qt::Key_F1 ) {
e->accept();
ClickOnHelp();

View File

@ -126,8 +126,15 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule):
// --> nodes
QLabel* myMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), myMeshWidget);
myMeshNbNodes = new QLabel(myMeshWidget);
myMeshNbNodes = new QLabel(myMeshWidget);
myMeshNbNodes->setMinimumWidth(100);
QFrame* line12 = new QFrame(myMeshWidget);
line12->setFrameStyle(QFrame::HLine | QFrame::Sunken);
// --> 0D elements
QLabel* myMeshNb0DElemsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_0DELEMS")), myMeshWidget);
myMeshNb0DElems = new QLabel(myMeshWidget);
myMeshNb0DElems->setMinimumWidth(100);
// --> header with orders
QLabel* myMeshOrder0Lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), myMeshWidget);
@ -290,16 +297,19 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule):
aMeshLayout->addWidget(line1, 1, 0, 1, 2);
aMeshLayout->addWidget(myMeshNbNodesLab, 2, 0);
aMeshLayout->addWidget(myMeshNbNodes, 2, 1);
aMeshLayout->addWidget(myMeshOrder0Lab, 3, 1);
aMeshLayout->addWidget(myMeshOrder1Lab, 3, 2);
aMeshLayout->addWidget(myMeshOrder2Lab, 3, 3);
aMeshLayout->addWidget(myMeshNbEdgesLab, 4, 0);
aMeshLayout->addWidget(myMeshNbEdges, 4, 1);
aMeshLayout->addWidget(myMeshNbEdges1, 4, 2);
aMeshLayout->addWidget(myMeshNbEdges2, 4, 3);
aMeshLayout->addWidget(myMeshFacesGroup, 5, 0, 1, 4);
aMeshLayout->addWidget(myMeshVolumesGroup, 6, 0, 1, 4);
aMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 7, 0);
aMeshLayout->addWidget(line12, 3, 0, 1, 2);
aMeshLayout->addWidget(myMeshNb0DElemsLab, 4, 0);
aMeshLayout->addWidget(myMeshNb0DElems, 4, 1);
aMeshLayout->addWidget(myMeshOrder0Lab, 5, 1);
aMeshLayout->addWidget(myMeshOrder1Lab, 5, 2);
aMeshLayout->addWidget(myMeshOrder2Lab, 5, 3);
aMeshLayout->addWidget(myMeshNbEdgesLab, 6, 0);
aMeshLayout->addWidget(myMeshNbEdges, 6, 1);
aMeshLayout->addWidget(myMeshNbEdges1, 6, 2);
aMeshLayout->addWidget(myMeshNbEdges2, 6, 3);
aMeshLayout->addWidget(myMeshFacesGroup, 7, 0, 1, 4);
aMeshLayout->addWidget(myMeshVolumesGroup, 8, 0, 1, 4);
aMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 9, 0);
// submesh
mySubMeshWidget = new QWidget(myWGStack);
@ -331,6 +341,11 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule):
mySubMeshNbElements->setMinimumWidth(100);
mySubMeshNbElements->setFont(fnt);
// --> 0D elements
QLabel* mySubMeshNb0DElemsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_0DELEMS")), mySubMeshElementsGroup);
mySubMeshNb0DElems = new QLabel(mySubMeshElementsGroup);
mySubMeshNb0DElems->setMinimumWidth(100);
// --> elements --> edges
QLabel* mySubMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), mySubMeshElementsGroup);
mySubMeshNbEdges = new QLabel(mySubMeshElementsGroup);
@ -348,12 +363,14 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule):
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElementsLab, 0, 0);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElements, 0, 1);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdgesLab, 1, 0);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdges, 1, 1);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFacesLab, 2, 0);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFaces, 2, 1);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumesLab, 3, 0);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumes, 3, 1);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNb0DElemsLab, 1, 0);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNb0DElems, 1, 1);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdgesLab, 2, 0);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdges, 2, 1);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFacesLab, 3, 0);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFaces, 3, 1);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumesLab, 4, 0);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumes, 4, 1);
aSubMeshLayout->addWidget(mySubMeshNameLab, 0, 0);
aSubMeshLayout->addWidget(mySubMeshName, 0, 1);
@ -466,6 +483,7 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
myMeshName->setText(aSO->GetName().c_str());
myMeshNbNodes->setNum((int)aMesh->NbNodes());
myMeshNb0DElems->setNum((int)aMesh->Nb0DElements());
myMeshNbEdges->setNum((int)aMesh->NbEdges());
myMeshNbEdges1->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_LINEAR));
myMeshNbEdges2->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_QUADRATIC));
@ -504,6 +522,7 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
mySubMeshName->setText(aSO->GetName().c_str());
mySubMeshNbNodes->setNum((int)aSubMesh->GetNumberOfNodes(true));
mySubMeshNbElements->setNum((int)aSubMesh->GetNumberOfElements());
mySubMeshNb0DElems->setNum((int)(aSubMesh->GetElementsByType(SMESH::ELEM0D)->length()));
mySubMeshNbEdges->setNum((int)(aSubMesh->GetElementsByType(SMESH::EDGE)->length()));
mySubMeshNbFaces->setNum((int)(aSubMesh->GetElementsByType(SMESH::FACE)->length()));
mySubMeshNbVolumes->setNum((int)(aSubMesh->GetElementsByType(SMESH::VOLUME)->length()));
@ -519,6 +538,8 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
switch (aType) {
case SMESH::NODE:
strType = "SMESH_MESHINFO_NODES"; break;
case SMESH::ELEM0D:
strType = "SMESH_MESHINFO_0DELEMS"; break;
case SMESH::EDGE:
strType = "SMESH_MESHINFO_EDGES"; break;
case SMESH::FACE:

View File

@ -75,6 +75,7 @@ private:
QWidget* myMeshWidget;
QLabel* myMeshName;
QLabel* myMeshNbNodes;
QLabel* myMeshNb0DElems;
QLabel* myMeshNbEdges;
QLabel* myMeshNbEdges1;
QLabel* myMeshNbEdges2;
@ -112,6 +113,7 @@ private:
QLabel* mySubMeshNbNodes;
QGroupBox* mySubMeshElementsGroup;
QLabel* mySubMeshNbElements;
QLabel* mySubMeshNb0DElems;
QLabel* mySubMeshNbEdges;
QLabel* mySubMeshNbFaces;
QLabel* mySubMeshNbVolumes;

View File

@ -142,7 +142,7 @@ SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const
//=======================================================================
//function : elemTypes
//purpose : may return {'Edge' 'Face' 'Volume'} at most
//purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume'} at most
//=======================================================================
QList<QVariant> SMESHGUI_Selection::elemTypes( int ind ) const
@ -152,6 +152,7 @@ QList<QVariant> SMESHGUI_Selection::elemTypes( int ind ) const
if ( actor ) {
TVisualObjPtr object = actor->GetObject();
if ( object ) {
if ( object->GetNbEntities( SMDSAbs_0DElement )) types.append( "Elem0d" );
if ( object->GetNbEntities( SMDSAbs_Edge )) types.append( "Edge" );
if ( object->GetNbEntities( SMDSAbs_Face )) types.append( "Face" );
if ( object->GetNbEntities( SMDSAbs_Volume )) types.append( "Volume" );
@ -231,7 +232,7 @@ QString SMESHGUI_Selection::shrinkMode( int ind ) const
//=======================================================================
//function : entityMode
//purpose : may return {'Edge' 'Face' 'Volume'} at most
//purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume'} at most
//=======================================================================
QList<QVariant> SMESHGUI_Selection::entityMode( int ind ) const
@ -240,9 +241,10 @@ QList<QVariant> SMESHGUI_Selection::entityMode( int ind ) const
SMESH_Actor* actor = getActor( ind );
if ( actor ) {
unsigned int aMode = actor->GetEntityMode();
if ( aMode & SMESH_Actor::eVolumes) types.append( "Volume");
if ( aMode & SMESH_Actor::eFaces ) types.append( "Face" );
if ( aMode & SMESH_Actor::eEdges ) types.append( "Edge" );
if ( aMode & SMESH_Actor::eVolumes ) types.append( "Volume" );
if ( aMode & SMESH_Actor::eFaces ) types.append( "Face" );
if ( aMode & SMESH_Actor::eEdges ) types.append( "Edge" );
if ( aMode & SMESH_Actor::e0DElements ) types.append( "Elem0d" );
}
return types;
}

View File

@ -810,6 +810,15 @@ namespace SMESH
int SW = mgr->integerValue( "SMESH", "selection_width", 5 ),
PW = mgr->integerValue( "SMESH", "highlight_width", 5 );
// adjust highlight_width to the width of mesh entities
int aPointSize = mgr->integerValue("SMESH", "node_size", 3);
int aElem0DSize = mgr->integerValue("SMESH", "elem0d_size", 5);
int aLineWidth = mgr->integerValue("SMESH", "element_width", 1);
int maxSize = aPointSize;
if (aElem0DSize > maxSize) maxSize = aElem0DSize;
if (aLineWidth > maxSize) maxSize = aLineWidth;
if (PW < maxSize + 2) PW = maxSize + 2;
double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ),
SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 ),
SP3 = mgr->doubleValue( "SMESH", "selection_precision_object", 0.025 );

View File

@ -443,6 +443,8 @@ void SMESHGUI_WhatIsDlg::SelectionIntoArgument()
if(e->GetType() == SMDSAbs_Node) {
anInfo+=tr("MESH_NODE")+"<br>";
//const SMDS_MeshNode *en = (SMDS_MeshNode*) e; // VSR: not used!
} else if (e->GetType() == SMDSAbs_0DElement) {
anInfo+=tr("SMESH_ELEM0D")+"<br>";
} else if(e->GetType() == SMDSAbs_Edge) {
anInfo+=tr("SMESH_EDGE")+"<br>";
anInfo+="<b>" + tr("SMESH_MESHINFO_TYPE")+":</b> ";

View File

@ -109,6 +109,10 @@
<source>ICON_DLG_BUILD_COMPOUND_MESH</source>
<translation>mesh_build_compound.png</translation>
</message>
<message>
<source>ICON_DLG_ELEM0D</source>
<translation>mesh_vertex.png</translation>
</message>
<message>
<source>ICON_DLG_EDGE</source>
<translation>mesh_line.png</translation>

View File

@ -261,6 +261,14 @@
<source>MEN_DISP_ENT</source>
<translation>Display Entity</translation>
</message>
<message>
<source>MEN_ELEM0D</source>
<translation>0D Element</translation>
</message>
<message>
<source>MEN_ELEMS0D</source>
<translation>0D Elements</translation>
</message>
<message>
<source>MEN_EDGE</source>
<translation>Edge</translation>
@ -739,6 +747,14 @@ Please enter correct values and try again</translation>
<source>SMESH_ADD_ALGORITHM_TITLE</source>
<translation>Algorithms Assignation</translation>
</message>
<message>
<source>SMESH_ADD_ELEM0D</source>
<translation>Add 0D Element</translation>
</message>
<message>
<source>SMESH_ADD_ELEM0D_TITLE</source>
<translation>Add 0D Element</translation>
</message>
<message>
<source>SMESH_ADD_EDGE</source>
<translation>Add Edge</translation>
@ -1063,6 +1079,10 @@ so that the application may crash. Do you wish to continue visualization?</trans
<source>SMESH_DZ</source>
<translation>dZ</translation>
</message>
<message>
<source>SMESH_ELEM0D</source>
<translation>0D Element</translation>
</message>
<message>
<source>SMESH_EDGE</source>
<translation>Edge</translation>
@ -1404,6 +1424,10 @@ Are you sure want to export to MED 2.1 ?</translation>
<source>SMESH_MESH</source>
<translation>Mesh</translation>
</message>
<message>
<source>SMESH_MESHINFO_0DELEMS</source>
<translation>0D Elements</translation>
</message>
<message>
<source>SMESH_MESHINFO_ALL_TYPES</source>
<translation>Heterogenous</translation>
@ -2071,6 +2095,14 @@ Consider saving your work before application crash</translation>
<source>STB_DISP_ENT</source>
<translation>Display entity</translation>
</message>
<message>
<source>STB_ELEM0D</source>
<translation>0D Element</translation>
</message>
<message>
<source>STB_ELEMS0D</source>
<translation>0D Elements</translation>
</message>
<message>
<source>STB_EDGE</source>
<translation>Edge</translation>
@ -2557,6 +2589,14 @@ Consider saving your work before application crash</translation>
<source>TOP_DISP_ENT</source>
<translation>Display entity</translation>
</message>
<message>
<source>TOP_ELEM0D</source>
<translation>0D Element</translation>
</message>
<message>
<source>TOP_ELEMS0D</source>
<translation>0D Elements</translation>
</message>
<message>
<source>TOP_EDGE</source>
<translation>Edge</translation>
@ -3127,6 +3167,14 @@ Please, create VTK viewer and try again</translation>
<source>PREF_TITLE_COLOR</source>
<translation>Title color</translation>
</message>
<message>
<source>PREF_COLOR_0D</source>
<translation>0D elements</translation>
</message>
<message>
<source>PREF_SIZE_0D</source>
<translation>Size of 0D elements</translation>
</message>
<message>
<source>PREF_WIDTH</source>
<translation>Width</translation>

View File

@ -1066,7 +1066,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
static TStringSet sameMethods;
if ( sameMethods.empty() ) {
const char * names[] = {
"RemoveElements","RemoveNodes","AddNode","AddEdge","AddFace","AddPolygonalFace",
"RemoveElements","RemoveNodes","AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace",
"AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode", "MoveClosestNodeToPoint",
"InverseDiag","DeleteDiag","Reorient","ReorientObject","TriToQuad","SplitQuad","SplitQuadObject",
"BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",

View File

@ -26,6 +26,7 @@
#include "SMESH_MeshEditor_i.hxx"
#include "SMDS_Mesh0DElement.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
@ -319,6 +320,47 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::long_array & IDsOfNo
*/
//=============================================================================
CORBA::Long SMESH_MeshEditor_i::AddNode(CORBA::Double x,
CORBA::Double y, CORBA::Double z)
{
initData();
const SMDS_MeshNode* N = GetMeshDS()->AddNode(x, y, z);
// Update Python script
TPythonDump() << "nodeID = " << this << ".AddNode( "
<< x << ", " << y << ", " << z << " )";
return N->GetID();
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_MeshEditor_i::Add0DElement(CORBA::Long IDOfNode)
{
initData();
const SMDS_MeshNode* aNode = GetMeshDS()->FindNode(IDOfNode);
SMDS_MeshElement* elem = GetMeshDS()->Add0DElement(aNode);
// Update Python script
TPythonDump() << "elem0d = " << this << ".Add0DElement( " << IDOfNode <<" )";
if (elem)
return elem->GetID();
return 0;
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes)
{
initData();
@ -353,26 +395,6 @@ CORBA::Long SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes)
return 0;
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_MeshEditor_i::AddNode(CORBA::Double x,
CORBA::Double y, CORBA::Double z)
{
initData();
const SMDS_MeshNode* N = GetMeshDS()->AddNode(x, y, z);
// Update Python script
TPythonDump() << "nodeID = " << this << ".AddNode( "
<< x << ", " << y << ", " << z << " )";
return N->GetID();
}
//=============================================================================
/*!
* AddFace

View File

@ -55,6 +55,7 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
* Returns ID of created element or 0 if element not created
*/
CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
CORBA::Long Add0DElement(CORBA::Long IDOfNode);
CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes);
CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes);
CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes);

View File

@ -2416,6 +2416,17 @@ CORBA::Long SMESH_Mesh_i::NbElements()throw (SALOME::SALOME_Exception)
return NbEdges() + NbFaces() + NbVolumes();
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_Mesh_i::Nb0DElements()throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
return _impl->Nb0DElements();
}
//=============================================================================
/*!
*

View File

@ -227,6 +227,9 @@ public:
CORBA::Long NbElements()
throw (SALOME::SALOME_Exception);
CORBA::Long Nb0DElements()
throw (SALOME::SALOME_Exception);
CORBA::Long NbEdges()
throw (SALOME::SALOME_Exception);

View File

@ -1600,6 +1600,12 @@ class Mesh:
def NbElements(self):
return self.mesh.NbElements()
## Returns the number of 0d elements in the mesh
# @return an integer value
# @ingroup l1_meshinfo
def Nb0DElements(self):
return self.mesh.Nb0DElements()
## Returns the number of edges in the mesh
# @return an integer value
# @ingroup l1_meshinfo
@ -1938,6 +1944,13 @@ class Mesh:
self.mesh.SetParameters(Parameters)
return self.editor.AddNode( x, y, z)
## Creates a 0D element on a node with given number.
# @param IDOfNode the ID of node for creation of the element.
# @return the Id of the new 0D element
# @ingroup l2_modif_add
def Add0DElement(self, IDOfNode):
return self.editor.Add0DElement(IDOfNode)
## Creates a linear or quadratic edge (this is determined
# by the number of given nodes).
# @param IDsOfNodes the list of node IDs for creation of the element.