PR: test of use of vtk structures in SMDS, first part: only nodes, tested only with hexahedrons.

This commit is contained in:
prascle 2009-09-24 12:26:05 +00:00
parent ec71bd93d2
commit 6cf440ddd4
34 changed files with 811 additions and 471 deletions

View File

@ -76,6 +76,9 @@ if test -z $QWTHOME; then
if test ! -f $QWT_INCDIR/qwt.h ; then
QWT_INCDIR=/usr/lib/qt4/include/qwt
fi
if test ! -f $QWT_INCDIR/qwt.h ; then
QWT_INCDIR=/usr/include/qwt-qt4
fi
fi
else
qwt_ok=no

View File

@ -31,7 +31,7 @@ CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = NO
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = YES
@ -69,7 +69,7 @@ CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = NO
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
@ -91,7 +91,7 @@ WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
WARN_LOGFILE = log.txt
#---------------------------------------------------------------------------
# configuration options related to the input files
@ -116,19 +116,19 @@ FILTER_SOURCE_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
SOURCE_BROWSER = YES
INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
USE_HTAGS = NO
#USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 3
COLS_IN_ALPHA_INDEX = 2
IGNORE_PREFIX =
#---------------------------------------------------------------------------
@ -137,19 +137,19 @@ IGNORE_PREFIX =
GENERATE_HTML = YES
HTML_OUTPUT = .
HTML_FILE_EXTENSION = .html
HTML_HEADER = @srcdir@/static/myheader.html
HTML_FOOTER = @srcdir@/static/footer.html
HTML_STYLESHEET = @srcdir@/static/doxygen.css
#HTML_HEADER = @srcdir@/static/myheader.html
#HTML_FOOTER = @srcdir@/static/footer.html
#HTML_STYLESHEET = @srcdir@/static/doxygen.css
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = YES
TOC_EXPAND = YES
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
@ -212,14 +212,14 @@ PERLMOD_MAKEVAR_PREFIX =
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = NO
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
@ -237,24 +237,24 @@ CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = NO
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = NO
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = jpg
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1200
MAX_DOT_GRAPH_DEPTH = 0
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------

View File

@ -45,6 +45,7 @@ dist_SMESHControls_SOURCES = \
# additionnal information to compil and link file
libSMESHControls_la_CPPFLAGS = \
$(CAS_CPPFLAGS) \
$(VTK_INCLUDES) \
$(BOOST_CPPFLAGS) \
$(KERNEL_CXXFLAGS) \
-I$(srcdir)/../SMDS \

View File

@ -2815,7 +2815,7 @@ void ManifoldPart::expandBoundary
void ManifoldPart::getFacesByLink( const ManifoldPart::Link& theLink,
ManifoldPart::TVectorOfFacePtr& theFaces ) const
{
SMDS_Mesh::SetOfFaces aSetOfFaces;
std::set<SMDS_MeshCell *> aSetOfFaces;
// take all faces that shared first node
SMDS_ElemIteratorPtr anItr = theLink.myNode1->facesIterator();
for ( ; anItr->more(); )
@ -2823,7 +2823,7 @@ void ManifoldPart::getFacesByLink( const ManifoldPart::Link& theLink,
SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
if ( !aFace )
continue;
aSetOfFaces.Add( aFace );
aSetOfFaces.insert( aFace );
}
// take all faces that shared second node
anItr = theLink.myNode2->facesIterator();
@ -2831,7 +2831,7 @@ void ManifoldPart::getFacesByLink( const ManifoldPart::Link& theLink,
for ( ; anItr->more(); )
{
SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
if ( aSetOfFaces.Contains( aFace ) )
if ( aSetOfFaces.count( aFace ) )
theFaces.push_back( aFace );
}
}

View File

@ -58,6 +58,7 @@ dist_DAT_Test_SOURCES = \
libMeshDriverDAT_la_CPPFLAGS = \
$(KERNEL_CXXFLAGS) \
$(CAS_CPPFLAGS) \
$(VTK_INCLUDES) \
$(BOOST_CPPFLAGS) \
-I$(srcdir)/../Driver \
-I$(srcdir)/../SMDS \

View File

@ -63,6 +63,7 @@ libMeshDriverMED_la_CPPFLAGS = \
@HDF5_INCLUDES@ \
$(KERNEL_CXXFLAGS) \
$(CAS_CPPFLAGS) \
$(VTK_INCLUDES) \
$(BOOST_CPPFLAGS) \
-I$(srcdir)/../Driver \
-I$(srcdir)/../SMDS \

View File

@ -52,6 +52,7 @@ dist_STL_Test_SOURCES = \
libMeshDriverSTL_la_CPPFLAGS = \
$(KERNEL_CXXFLAGS) \
$(CAS_CPPFLAGS) \
$(VTK_INCLUDES) \
$(BOOST_CPPFLAGS) \
-I$(srcdir)/../Driver \
-I$(srcdir)/../SMDS

View File

@ -71,6 +71,7 @@ libMeshDriverUNV_la_CPPFLAGS = \
$(CAS_CPPFLAGS) \
$(CORBA_CXXFLAGS) \
$(CORBA_INCLUDES) \
$(VTK_INCLUDES) \
$(BOOST_CPPFLAGS) \
-I$(srcdir)/../Driver \
-I$(srcdir)/../SMDS \

View File

@ -43,6 +43,7 @@ salomeinclude_HEADERS = \
SMDS_MeshGroup.hxx \
SMDS_MeshIDFactory.hxx \
SMDS_MeshNode.hxx \
SMDS_MeshNodeIDFactory.hxx \
SMDS_MeshObject.hxx \
SMDS_MeshVolume.hxx \
SMDS_Position.hxx \
@ -81,6 +82,7 @@ dist_libSMDS_la_SOURCES = \
SMDS_MeshEdge.cxx \
SMDS_MeshFace.cxx \
SMDS_MeshVolume.cxx \
SMDS_MeshNodeIDFactory.cxx \
SMDS_MeshElementIDFactory.cxx \
SMDS_MeshGroup.cxx \
SMDS_MeshIDFactory.cxx \
@ -101,9 +103,11 @@ dist_libSMDS_la_SOURCES = \
libSMDS_la_CPPFLAGS = \
$(KERNEL_CXXFLAGS) \
$(CAS_CPPFLAGS) \
$(VTK_INCLUDES) \
$(BOOST_CPPFLAGS)
libSMDS_la_LDFLAGS = \
$(VTK_LIBS) \
$(KERNEL_LDFLAGS) -lSALOMELocalTrace \
$(CAS_KERNEL)

File diff suppressed because it is too large Load Diff

View File

@ -33,20 +33,28 @@
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
#include "SMDS_MeshNodeIDFactory.hxx"
#include "SMDS_MeshElementIDFactory.hxx"
#include "SMDS_MeshInfo.hxx"
#include "SMDS_ElemIterator.hxx"
#include <NCollection_Map.hxx>
#include <boost/shared_ptr.hpp>
#include <set>
#include <list>
#include <vector>
#include <vtkSystemIncludes.h>
class vtkUnstructuredGrid;
class SMDS_EXPORT SMDS_Mesh:public SMDS_MeshObject{
public:
static std::vector<SMDS_Mesh*> _meshList; // --- to find the SMDS_mesh from its elements
SMDS_Mesh();
inline vtkUnstructuredGrid* getGrid() {return myGrid; };
SMDS_NodeIteratorPtr nodesIterator() const;
SMDS_0DElementIteratorPtr elements0dIterator() const;
SMDS_EdgeIteratorPtr edgesIterator() const;
@ -537,11 +545,15 @@ 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;
typedef std::vector<SMDS_MeshNode *> SetOfNodes;
typedef std::vector<SMDS_MeshCell *> SetOfCells;
void updateNodeMinMax();
int fromVtkToSmds(int vtkid) { return myElementIDFactory->fromVtkToSmds(vtkid); };
int myCellLinksSize;
static int chunkSize;
private:
SMDS_Mesh(SMDS_Mesh * parent);
@ -552,8 +564,9 @@ private:
SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4);
SMDS_Mesh0DElement* Find0DElementOrCreate(const SMDS_MeshNode * n);
const SMDS_MeshNode * node4,
int ID);
// 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,
@ -570,19 +583,36 @@ private:
const SMDS_MeshElement * element,
std::set<const SMDS_MeshElement*>& nodes);
inline void adjustmyCellsCapacity(int ID)
{
assert(ID >= 0);
if (ID >= myCells.size())
myCells.resize(ID+SMDS_Mesh::chunkSize,0);
};
// Fields PRIVATE
int myMeshId; // --- index for this mesh in the vector
vtkUnstructuredGrid* myGrid;
SetOfNodes myNodes;
SetOf0DElements my0DElements;
SetOfEdges myEdges;
SetOfFaces myFaces;
SetOfVolumes myVolumes;
SetOfCells myCells;
// SetOf0DElements my0DElements;
// SetOfEdges myEdges;
// SetOfFaces myFaces;
// SetOfVolumes myVolumes;
SMDS_Mesh * myParent;
std::list<SMDS_Mesh *> myChildren;
SMDS_MeshElementIDFactory *myNodeIDFactory;
SMDS_MeshNodeIDFactory *myNodeIDFactory;
SMDS_MeshElementIDFactory *myElementIDFactory;
SMDS_MeshInfo myInfo;
int myNodeMin;
int myNodeMax;
bool myHasConstructionEdges;
bool myHasConstructionFaces;
bool myHasInverseElements;

View File

@ -31,6 +31,7 @@
#include "SMDS_Mesh0DElement.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
#include "utilities.h"
using namespace std;
@ -39,7 +40,8 @@ using namespace std;
//purpose :
//=======================================================================
SMDS_Mesh0DElement::SMDS_Mesh0DElement (const SMDS_MeshNode * node)
{
{
MESSAGE("SMDS_Mesh0DElement " << GetID());
myNode = node;
}

View File

@ -32,7 +32,7 @@
#include <iostream>
class SMDS_EXPORT SMDS_Mesh0DElement: public SMDS_MeshElement
class SMDS_EXPORT SMDS_Mesh0DElement: public SMDS_MeshCell
{
public:
SMDS_Mesh0DElement (const SMDS_MeshNode * node);

View File

@ -31,6 +31,7 @@
#include "SMDS_MeshEdge.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
#include "utilities.h"
using namespace std;
@ -42,6 +43,7 @@ using namespace std;
SMDS_MeshEdge::SMDS_MeshEdge(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2)
{
//MESSAGE("SMDS_MeshEdge " << GetID());
myNodes[0]=node1;
myNodes[1]=node2;
}

View File

@ -31,7 +31,7 @@
#include "SMDS_MeshElement.hxx"
#include <iostream>
class SMDS_EXPORT SMDS_MeshEdge:public SMDS_MeshElement
class SMDS_EXPORT SMDS_MeshEdge:public SMDS_MeshCell
{
public:

View File

@ -38,6 +38,11 @@ SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID)
{
}
SMDS_MeshElement::SMDS_MeshElement(int id, UShortType meshId, ShortType shapeId):
myID(id), myMeshId(meshId), myShapeId(shapeId)
{
}
void SMDS_MeshElement::Print(ostream & OS) const
{
OS << "dump of mesh element" << endl;
@ -238,3 +243,8 @@ int SMDS_MeshElement::GetNodeIndex( const SMDS_MeshNode* node ) const
return i;
return -1;
}
SMDS_MeshCell::SMDS_MeshCell()
{
myVtkID = -1;
};

View File

@ -36,6 +36,9 @@
#include <vector>
#include <iostream>
typedef unsigned short UShortType;
typedef short ShortType;
class SMDS_MeshNode;
class SMDS_MeshEdge;
class SMDS_MeshFace;
@ -116,14 +119,38 @@ public:
*/
int GetNodeIndex( const SMDS_MeshNode* node ) const;
inline int getId() {return myID; };
inline UShortType getMeshId() {return myMeshId; };
inline ShortType getshapeId() {return myShapeId; };
inline void setShapeId(UShortType shapeId) {myShapeId = shapeId; };
protected:
SMDS_MeshElement(int ID=-1);
SMDS_MeshElement(int id, UShortType meshId, ShortType shapeId=-1);
virtual void Print(std::ostream & OS) const;
private:
int myID;
int myID; // --- element index
UShortType myMeshId;
ShortType myShapeId;
};
// ============================================================
/*!
* \brief Base class for all cells
*/
// ============================================================
class SMDS_EXPORT SMDS_MeshCell:public SMDS_MeshElement
{
public:
SMDS_MeshCell();
inline void setVtkId(int vtkId) { myVtkID = vtkId; };
inline int getVtkId() const {return myVtkID; };
protected:
int myVtkID;
};
// ============================================================
/*!
* \brief Comparator of elements by ID for usage in std containers

View File

@ -30,6 +30,12 @@
#include "SMDS_MeshElementIDFactory.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_Mesh.hxx"
#include "utilities.h"
#include <vtkUnstructuredGrid.h>
#include <vtkCellType.h>
using namespace std;
@ -38,9 +44,32 @@ using namespace std;
//purpose :
//=======================================================================
SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():
SMDS_MeshIDFactory(),
myMin(0), myMax(0)
SMDS_MeshNodeIDFactory()
{
myIDElements.clear();
myVtkIndex.clear();
myVtkCellTypes.clear();
myVtkCellTypes.reserve(SMDSEntity_Last);
myVtkCellTypes[SMDSEntity_Node] = VTK_VERTEX;
myVtkCellTypes[SMDSEntity_0D] = VTK_VERTEX;
myVtkCellTypes[SMDSEntity_Edge] = VTK_LINE;
myVtkCellTypes[SMDSEntity_Quad_Edge] = VTK_QUADRATIC_EDGE;
myVtkCellTypes[SMDSEntity_Triangle] = VTK_TRIANGLE;
myVtkCellTypes[SMDSEntity_Quad_Triangle] = VTK_QUADRATIC_TRIANGLE;
myVtkCellTypes[SMDSEntity_Quadrangle] = VTK_QUAD;
myVtkCellTypes[SMDSEntity_Quad_Quadrangle] = VTK_QUADRATIC_TRIANGLE;
myVtkCellTypes[SMDSEntity_Polygon] = VTK_POLYGON;
myVtkCellTypes[SMDSEntity_Quad_Polygon] = VTK_POLYGON; // -PR- verifer
myVtkCellTypes[SMDSEntity_Tetra] = VTK_TETRA;
myVtkCellTypes[SMDSEntity_Quad_Tetra] = VTK_QUADRATIC_TETRA;
myVtkCellTypes[SMDSEntity_Pyramid] = VTK_PYRAMID;
myVtkCellTypes[SMDSEntity_Quad_Pyramid] = VTK_CONVEX_POINT_SET;
myVtkCellTypes[SMDSEntity_Hexa] = VTK_HEXAHEDRON;
myVtkCellTypes[SMDSEntity_Quad_Hexa] = VTK_QUADRATIC_HEXAHEDRON;
myVtkCellTypes[SMDSEntity_Penta] = VTK_WEDGE;
myVtkCellTypes[SMDSEntity_Quad_Penta] = VTK_QUADRATIC_WEDGE;
myVtkCellTypes[SMDSEntity_Polyhedra] = VTK_CONVEX_POINT_SET;
myVtkCellTypes[SMDSEntity_Quad_Polyhedra] = VTK_CONVEX_POINT_SET;
}
//=======================================================================
@ -49,10 +78,51 @@ SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():
//=======================================================================
bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
{
if (myIDElements.IsBound(ID))
return false;
myIDElements.Bind(ID,elem);
if ((ID < myIDElements.size()) && myIDElements[ID] >= 0) // --- already bound
{
MESSAGE(" --------------------------------- already bound "<< ID << " " << myIDElements[ID]);
return false;
}
if (ID >= myIDElements.size()) // --- resize local vector
{
//MESSAGE(" ------------------- resize myIDElements " << ID << " --> " << ID+SMDS_Mesh::chunkSize);
myIDElements.resize(ID+SMDS_Mesh::chunkSize,-1); // fill new elements with -1
}
// --- retreive nodes ID
vector<int> nodeIds;
SMDS_ElemIteratorPtr it = elem->nodesIterator();
while(it->more())
{
int nodeId = it->next()->GetID();
//MESSAGE(" node in cell " << ID << " : " <<nodeId)
nodeIds.push_back(nodeId);
}
// --- insert cell in vtkUnstructuredGrid
vtkUnstructuredGrid * grid = myMesh->getGrid();
int typ = GetVtkCellType(elem->GetType());
int cellId = grid->InsertNextLinkedCell(typ, nodeIds.size(), &nodeIds[0]);
// --- fill local vector
myIDElements[ID] = cellId;
//MESSAGE("smds:" << ID << " vtk:" << cellId );
if (cellId >= myVtkIndex.size()) // --- resize local vector
{
//MESSAGE(" --------------------- resize myVtkIndex " << cellId << " --> " << cellId+SMDS_Mesh::chunkSize);
myVtkIndex.resize(cellId+SMDS_Mesh::chunkSize, -1);
}
myVtkIndex[cellId] = ID;
elem->myID=ID;
SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(elem);
assert(cell);
cell->setVtkId(cellId);
updateMinMax (ID);
return true;
}
@ -63,23 +133,10 @@ bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
//=======================================================================
SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
{
if (!myIDElements.IsBound(ID))
if ((ID<0) || (ID>myMax) || (myIDElements[ID]<0))
return NULL;
return myIDElements.Find(ID);
}
//=======================================================================
//function : GetFreeID
//purpose :
//=======================================================================
int SMDS_MeshElementIDFactory::GetFreeID()
{
int ID;
do {
ID = SMDS_MeshIDFactory::GetFreeID();
} while (myIDElements.IsBound(ID));
return ID;
const SMDS_MeshElement* elem = GetMesh()->FindElement(ID);
return (SMDS_MeshElement*)(elem);
}
//=======================================================================
@ -88,36 +145,12 @@ int SMDS_MeshElementIDFactory::GetFreeID()
//=======================================================================
void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
{
myIDElements.UnBind(ID);
myIDElements[ID] = -1;
SMDS_MeshIDFactory::ReleaseID(ID);
if (ID == myMax)
myMax = 0;
if (ID == myMin)
myMin = 0;
}
//=======================================================================
//function : GetMaxID
//purpose :
//=======================================================================
int SMDS_MeshElementIDFactory::GetMaxID() const
{
if (myMax == 0)
updateMinMax();
return myMax;
}
//=======================================================================
//function : GetMinID
//purpose :
//=======================================================================
int SMDS_MeshElementIDFactory::GetMinID() const
{
if (myMin == 0)
updateMinMax();
return myMin;
myMax = 0;
}
//=======================================================================
@ -129,9 +162,12 @@ void SMDS_MeshElementIDFactory::updateMinMax() const
{
myMin = IntegerLast();
myMax = 0;
SMDS_IdElementMap::Iterator it(myIDElements);
for (; it.More(); it.Next())
updateMinMax (it.Key());
for (int i=0; i<myIDElements.size(); i++)
if (int id=myIDElements[i] >=0)
{
if (id > myMax) myMax = id;
if (id < myMin) myMin = id;
}
if (myMin == IntegerLast())
myMin = 0;
}
@ -141,35 +177,20 @@ void SMDS_MeshElementIDFactory::updateMinMax() const
//purpose : Return an iterator on elements of the factory
//=======================================================================
class SMDS_Fact_MyElemIterator:public SMDS_ElemIterator
{
SMDS_IdElementMap::Iterator myIterator;
public:
SMDS_Fact_MyElemIterator(const SMDS_IdElementMap& s):myIterator(s)
{}
bool more()
{
return myIterator.More() != Standard_False;
}
const SMDS_MeshElement* next()
{
const SMDS_MeshElement* current = myIterator.Value();
myIterator.Next();
return current;
}
};
SMDS_ElemIteratorPtr SMDS_MeshElementIDFactory::elementsIterator() const
{
return SMDS_ElemIteratorPtr
(new SMDS_Fact_MyElemIterator(myIDElements));
return myMesh->elementsIterator(SMDSAbs_All);
}
void SMDS_MeshElementIDFactory::Clear()
{
myIDElements.Clear();
myIDElements.clear();
myMin = myMax = 0;
SMDS_MeshIDFactory::Clear();
}
int SMDS_MeshElementIDFactory::GetVtkCellType(int SMDSType)
{
assert((SMDSType >=0) && (SMDSType< SMDSEntity_Last));
return myVtkCellTypes[SMDSType];
}

View File

@ -28,28 +28,25 @@
#include "SMESH_SMDS.hxx"
#include "SMDS_MeshIDFactory.hxx"
#include "SMDS_ElemIterator.hxx"
#include "SMDS_MeshNodeIDFactory.hxx"
#include <NCollection_DataMap.hxx>
#include <vector>
class SMDS_MeshElement;
typedef NCollection_DataMap<int, SMDS_MeshElement *> SMDS_IdElementMap;
class SMDS_EXPORT SMDS_MeshElementIDFactory:public SMDS_MeshIDFactory
class SMDS_EXPORT SMDS_MeshElementIDFactory:public SMDS_MeshNodeIDFactory
{
public:
SMDS_MeshElementIDFactory();
bool BindID(int ID, SMDS_MeshElement * elem);
SMDS_MeshElement * MeshElement(int ID);
virtual int GetFreeID();
virtual void ReleaseID(int ID);
int GetMaxID() const;
int GetMinID() const;
SMDS_ElemIteratorPtr elementsIterator() const;
virtual void Clear();
private:
int GetVtkCellType(int SMDSType);
int fromVtkToSmds(int vtkid) { return myVtkIndex[vtkid]; };
protected:
void updateMinMax() const;
void updateMinMax(int id) const
{
@ -57,8 +54,9 @@ private:
if (id < myMin) myMin = id;
}
SMDS_IdElementMap myIDElements;
mutable int myMin, myMax;
std::vector<int> myIDElements; // index = ID client, value = ID vtk
std::vector<int> myVtkIndex; // index = ID vtk, value = ID client
std::vector<int> myVtkCellTypes;
};

View File

@ -30,7 +30,7 @@
#include "SMDS_MeshElement.hxx"
class SMDS_EXPORT SMDS_MeshFace:public SMDS_MeshElement
class SMDS_EXPORT SMDS_MeshFace:public SMDS_MeshCell
{
public:
SMDSAbs_ElementType GetType() const;

View File

@ -25,6 +25,8 @@
// Module : SMESH
//
#include "SMDS_MeshIDFactory.hxx"
#include "SMDS_Mesh.hxx"
#include "utilities.h"
using namespace std;
@ -33,20 +35,26 @@ using namespace std;
//purpose :
//=======================================================================
SMDS_MeshIDFactory::SMDS_MeshIDFactory():myMaxID(0)
SMDS_MeshIDFactory::SMDS_MeshIDFactory():myMaxID(-1), myMesh(0)
{
}
int SMDS_MeshIDFactory::GetFreeID()
{
if (myPoolOfID.empty()) return ++myMaxID;
int newid;
if (myPoolOfID.empty())
{
newid = ++myMaxID;
//MESSAGE("GetFreeID new " << newid);
}
else
{
set<int>::iterator i = myPoolOfID.begin();
int ID = *i;//myPoolOfID.top();
newid = *i;//myPoolOfID.top();
myPoolOfID.erase( i );//myPoolOfID.pop();
return ID;
MESSAGE("GetFreeID pool " << newid);
}
return newid;
}
//=======================================================================
@ -55,7 +63,7 @@ int SMDS_MeshIDFactory::GetFreeID()
//=======================================================================
void SMDS_MeshIDFactory::ReleaseID(const int ID)
{
if ( ID > 0 )
if ( ID >= 0 )
{
if ( ID < myMaxID )
{
@ -82,6 +90,16 @@ void SMDS_MeshIDFactory::ReleaseID(const int ID)
void SMDS_MeshIDFactory::Clear()
{
myMaxID = 0;
myMaxID = -1;
myPoolOfID.clear();
}
void SMDS_MeshIDFactory::SetMesh(SMDS_Mesh *mesh)
{
myMesh = mesh;
}
SMDS_Mesh* SMDS_MeshIDFactory::GetMesh()
{
return myMesh;
}

View File

@ -31,18 +31,22 @@
#include "SMDS_MeshObject.hxx"
#include <set>
class SMDS_Mesh;
class SMDS_EXPORT SMDS_MeshIDFactory:public SMDS_MeshObject
{
public:
virtual int GetFreeID();
int GetFreeID();
virtual void ReleaseID(int ID);
virtual void Clear();
protected:
SMDS_MeshIDFactory();
int myMaxID;
std::set<int> myPoolOfID;
void SetMesh(SMDS_Mesh *mesh);
SMDS_Mesh* GetMesh();
protected:
SMDS_MeshIDFactory();
int myMaxID;
std::set<int> myPoolOfID;
SMDS_Mesh *myMesh;
};
#endif

View File

@ -28,6 +28,14 @@
#include "SMDS_MeshNode.hxx"
#include "SMDS_SpacePosition.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_Mesh.hxx"
#include <vtkUnstructuredGrid.h>
#define protected public
#include <vtkCellLinks.h>
#define protected protected
#include "utilities.h"
using namespace std;
@ -36,10 +44,50 @@ using namespace std;
//purpose :
//=======================================================================
SMDS_MeshNode::SMDS_MeshNode(double x, double y, double z):
myX(x), myY(y), myZ(z),
myPosition(SMDS_SpacePosition::originSpacePosition())
SMDS_MeshNode::SMDS_MeshNode(int id, int meshId, int shapeId, double x, double y, double z):
SMDS_MeshElement(id, meshId, shapeId),
myPosition(SMDS_SpacePosition::originSpacePosition())
{
//MESSAGE("Node " << myID << " (" << x << ", " << y << ", " << z << ")");
SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId];
vtkUnstructuredGrid * grid = mesh->getGrid();
vtkPoints *points = grid->GetPoints();
//int nbp = points->GetNumberOfPoints();
points->InsertPoint(myID, x, y, z);
if (myID >= mesh->myCellLinksSize)
{
//points->SetNumberOfPoints(myID+SMDS_Mesh::chunkSize);
vtkCellLinks *cellLinks = grid->GetCellLinks();
// int imax = cellLinks->Size;
// for (int i =0; i<imax; i++)
// {
// vtkCellLinks::Link &ilink = cellLinks->GetLink(i);
// int ncells = ilink.ncells;
// int *cells = ilink.cells;
// MESSAGE("NODE " << i << " " << cellLinks << " " << cells << " " << ncells);
// for (int j=0; j< ncells; j++)
// MESSAGE(" " << j << " " << cells[j]);
// }
cellLinks->Resize(myID+SMDS_Mesh::chunkSize);
// cellLinks = grid->GetCellLinks();
// imax = cellLinks->Size;
// for (int i =0; i<imax; i++)
// {
// vtkCellLinks::Link &ilink = cellLinks->GetLink(i);
// int ncells = ilink.ncells;
// int *cells = ilink.cells;
// MESSAGE("NODE " << i << " " << cellLinks << " " << cells << " " << ncells);
// for (int j=0; j< ncells; j++)
// MESSAGE(" " << j << " " << cells[j]);
// }
mesh->myCellLinksSize = cellLinks->Size;
//MESSAGE(" -------------------------------------- resize CellLinks " << myID << " --> " << mesh->myCellLinksSize);
}
//setXYZ(x, y, z);
}
//=======================================================================
@ -49,14 +97,8 @@ SMDS_MeshNode::SMDS_MeshNode(double x, double y, double z):
void SMDS_MeshNode::RemoveInverseElement(const SMDS_MeshElement * parent)
{
NCollection_List<const SMDS_MeshElement*>::Iterator it(myInverseElements);
while (it.More()) {
const SMDS_MeshElement* elem = it.Value();
if (elem == parent)
myInverseElements.Remove(it);
else
it.Next();
}
MESSAGE("RemoveInverseElement " << myID << " " << parent->GetID());
SMDS_Mesh::_meshList[myMeshId]->getGrid()->RemoveReferenceToCell(myID, parent->GetID()); // -PR- GetVtkID ?
}
//=======================================================================
@ -66,8 +108,8 @@ void SMDS_MeshNode::RemoveInverseElement(const SMDS_MeshElement * parent)
void SMDS_MeshNode::Print(ostream & OS) const
{
OS << "Node <" << GetID() << "> : X = " << myX << " Y = "
<< myY << " Z = " << myZ << endl;
OS << "Node <" << myID << "> : X = " << X() << " Y = "
<< Y() << " Z = " << Z() << endl;
}
//=======================================================================
@ -98,74 +140,88 @@ const SMDS_PositionPtr& SMDS_MeshNode::GetPosition() const
class SMDS_MeshNode_MyInvIterator:public SMDS_ElemIterator
{
NCollection_List<const SMDS_MeshElement*>::Iterator myIterator;
private:
SMDS_Mesh* myMesh;
int* myCells;
int myNcells;
SMDSAbs_ElementType myType;
int iter;
public:
SMDS_MeshNode_MyInvIterator(const NCollection_List<const SMDS_MeshElement*>& s,
SMDS_MeshNode_MyInvIterator(SMDS_Mesh *mesh,
int* cells,
int ncells,
SMDSAbs_ElementType type):
myIterator(s), myType(type)
{}
myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0)
{
//MESSAGE("SMDS_MeshNode_MyInvIterator : ncells " << myNcells);
}
bool more()
{
if ( myType != SMDSAbs_All ) {
while ( myIterator.More() && myIterator.Value()->GetType() != myType)
myIterator.Next();
}
return myIterator.More() != Standard_False;
return (iter< myNcells);
}
const SMDS_MeshElement* next()
{
const SMDS_MeshElement* current=myIterator.Value();
myIterator.Next();
return current;
int vtkId = myCells[iter];
int smdsId = myMesh->fromVtkToSmds(vtkId);
const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
iter++;
return elem;
}
};
SMDS_ElemIteratorPtr SMDS_MeshNode::
GetInverseElementIterator(SMDSAbs_ElementType type) const
{
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(myInverseElements,type));
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myID);
//MESSAGE("ncells " << l.ncells);
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
}
// Same as GetInverseElementIterator but the create iterator only return
// wanted type elements.
class SMDS_MeshNode_MyIterator:public SMDS_ElemIterator
{
NCollection_List<const SMDS_MeshElement*> mySet;
NCollection_List<const SMDS_MeshElement*>::Iterator myIterator;
private:
SMDS_Mesh* myMesh;
int* myCells;
int myNcells;
SMDSAbs_ElementType myType;
int iter;
vector<SMDS_MeshElement*> myFiltCells;
public:
SMDS_MeshNode_MyIterator(SMDSAbs_ElementType type,
const NCollection_List<const SMDS_MeshElement*>& s)
SMDS_MeshNode_MyIterator(SMDS_Mesh *mesh,
int* cells,
int ncells,
SMDSAbs_ElementType type):
myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0)
{
const SMDS_MeshElement * e;
bool toInsert;
NCollection_List<const SMDS_MeshElement*>::Iterator it(s);
for(; it.More(); it.Next())
{
e=it.Value();
switch(type)
{
case SMDSAbs_Edge: toInsert=true; break;
case SMDSAbs_Face: toInsert=(e->GetType()!=SMDSAbs_Edge); break;
case SMDSAbs_Volume: toInsert=(e->GetType()==SMDSAbs_Volume); break;
}
if(toInsert) mySet.Append(e);
}
myIterator.Init(mySet);
for (; iter<ncells; iter++)
{
int vtkId = myCells[iter];
int smdsId = myMesh->fromVtkToSmds(vtkId);
const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
if (elem->GetType() == type)
myFiltCells.push_back((SMDS_MeshElement*)elem);
}
myNcells = myFiltCells.size();
iter = 0;
//MESSAGE("SMDS_MeshNode_MyIterator (filter) " << ncells << " " << myNcells);
}
bool more()
{
return myIterator.More() != Standard_False;
return (iter< myNcells);
}
const SMDS_MeshElement* next()
{
const SMDS_MeshElement* current=myIterator.Value();
myIterator.Next();
return current;
const SMDS_MeshElement* elem = myFiltCells[iter];
iter++;
return elem;
}
};
@ -175,10 +231,10 @@ SMDS_ElemIteratorPtr SMDS_MeshNode::
if(type==SMDSAbs_Node)
return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
else
return SMDS_ElemIteratorPtr
(new SMDS_IteratorOfElements
(this,type,
SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(type, myInverseElements))));
{
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myID);
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
}
}
int SMDS_MeshNode::NbNodes() const
@ -186,26 +242,35 @@ int SMDS_MeshNode::NbNodes() const
return 1;
}
double* SMDS_MeshNode::getCoord() const
{
return SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoint(myID);
}
double SMDS_MeshNode::X() const
{
return myX;
double *coord = getCoord();
return coord[0];
}
double SMDS_MeshNode::Y() const
{
return myY;
double *coord = getCoord();
return coord[1];
}
double SMDS_MeshNode::Z() const
{
return myZ;
double *coord = getCoord();
return coord[2];
}
//* resize the vtkPoints structure every SMDS_Mesh::chunkSize points
void SMDS_MeshNode::setXYZ(double x, double y, double z)
{
myX=x;
myY=y;
myZ=z;
vtkPoints *points = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoints();
points->InsertPoint(myID, x, y, z);
}
SMDSAbs_ElementType SMDS_MeshNode::GetType() const
@ -219,13 +284,9 @@ SMDSAbs_ElementType SMDS_MeshNode::GetType() const
//=======================================================================
void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
{
NCollection_List<const SMDS_MeshElement*>::Iterator it(myInverseElements);
for (; it.More(); it.Next()) {
const SMDS_MeshElement* elem = it.Value();
if (elem == ME)
return;
}
myInverseElements.Append(ME);
const SMDS_MeshCell *cell = dynamic_cast<const SMDS_MeshCell*>(ME);
assert(cell);
SMDS_Mesh::_meshList[myMeshId]->getGrid()->AddReferenceToCell(myID, cell->getVtkId());
}
//=======================================================================
@ -234,12 +295,13 @@ void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
//=======================================================================
void SMDS_MeshNode::ClearInverseElements()
{
myInverseElements.Clear();
SMDS_Mesh::_meshList[myMeshId]->getGrid()->ResizeCellList(myID, 0);
}
bool SMDS_MeshNode::emptyInverseElements()
{
return myInverseElements.IsEmpty() != Standard_False;
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myID);
return (l.ncells == 0);
}
//================================================================================
@ -250,13 +312,19 @@ bool SMDS_MeshNode::emptyInverseElements()
int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
{
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myID);
if ( type == SMDSAbs_All )
return myInverseElements.Extent();
return l.ncells;
int nb = 0;
NCollection_List<const SMDS_MeshElement*>::Iterator it( myInverseElements );
for ( ; it.More(); it.Next() )
if ( it.Value()->GetType() == type )
nb++;
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
for (int i=0; i<l.ncells; i++)
{
const SMDS_MeshElement* elem = mesh->FindNode(l.cells[i]);
if (elem->GetType() == type)
nb++;
}
return nb;
}

View File

@ -36,7 +36,10 @@ class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement
{
public:
SMDS_MeshNode(double x, double y, double z);
SMDS_MeshNode(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
double* getCoord() const;
void Print(std::ostream & OS) const;
double X() const;
double Y() const;
@ -67,9 +70,7 @@ protected:
elementsIterator(SMDSAbs_ElementType type) const;
private:
double myX, myY, myZ;
SMDS_PositionPtr myPosition;
NCollection_List<const SMDS_MeshElement*> myInverseElements;
};
#endif

View File

@ -30,7 +30,7 @@
#include "SMDS_MeshElement.hxx"
class SMDS_EXPORT SMDS_MeshVolume:public SMDS_MeshElement
class SMDS_EXPORT SMDS_MeshVolume:public SMDS_MeshCell
{
public:

View File

@ -85,6 +85,7 @@ libSMESHimpl_la_CPPFLAGS = \
$(CAS_CPPFLAGS) \
$(MED_CXXFLAGS) \
$(GEOM_CXX_FLAGS) \
$(VTK_INCLUDES) \
$(BOOST_CPPFLAGS) \
@HDF5_INCLUDES@ \
-I$(srcdir)/../Controls \

View File

@ -30,6 +30,7 @@
#include "SMESHDS_Document.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMDS_Mesh.hxx"
#include "utilities.h"
#include "OpUtil.hxx"
@ -40,6 +41,8 @@
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include "memoire.h"
using namespace std;
//=============================================================================
@ -54,6 +57,8 @@ SMESH_Gen::SMESH_Gen()
_localId = 0;
_hypId = 0;
_segmentation = 10;
SMDS_Mesh::_meshList.clear();
MESSAGE(SMDS_Mesh::_meshList.size());
}
//=============================================================================
@ -135,6 +140,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
TSetOfInt* aShapesId)
{
MESSAGE("SMESH_Gen::Compute");
MEMOSTAT;
bool ret = true;
@ -284,6 +290,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
}
MESSAGE( "VSR - SMESH_Gen::Compute() finished, OK = " << ret);
MEMOSTAT;
return ret;
}

View File

@ -47,6 +47,7 @@ libSMESHClient_la_CPPFLAGS = \
$(MED_CXXFLAGS) \
$(GEOM_CXXFLAGS) \
$(BOOST_CPPFLAGS) \
$(VTK_INCLUDES) \
$(CAS_CPPFLAGS) \
$(CORBA_CXXFLAGS) \
$(CORBA_INCLUDES) \

View File

@ -60,6 +60,7 @@ dist_libSMESHDS_la_SOURCES = \
libSMESHDS_la_CPPFLAGS = \
$(KERNEL_CXXFLAGS) \
$(CAS_CPPFLAGS) \
$(VTK_INCLUDES) \
$(BOOST_CPPFLAGS) \
-I$(srcdir)/../SMDS

View File

@ -92,6 +92,7 @@ libSMESHEngine_la_CPPFLAGS = \
$(CORBA_INCLUDES) \
$(CAS_CPPFLAGS) \
@HDF5_INCLUDES@ \
$(VTK_INCLUDES) \
$(BOOST_CPPFLAGS) \
$(KERNEL_CXXFLAGS) \
$(GUI_CXXFLAGS) \

View File

@ -110,6 +110,7 @@
#include "GEOM_Client.hxx"
#include "Utils_ExceptHandlers.hxx"
#include "memoire.h"
#include <map>
@ -1375,6 +1376,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theShapeObject )
throw ( SALOME::SALOME_Exception )
{
MEMOSTAT;
Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Compute" );

View File

@ -965,7 +965,7 @@ throw (SALOME::SALOME_Exception)
try
{
NCollection_Map< int > anIds;
vector< int > anIds;
SMESH::ElementType aType = SMESH::ALL;
for ( int g = 0, n = theGroups.length(); g < n; g++ )
{
@ -988,7 +988,7 @@ throw (SALOME::SALOME_Exception)
for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
{
int aCurrId = aCurrIds[ i ];
anIds.Add( aCurrId );
anIds.push_back( aCurrId );
}
}
@ -999,12 +999,12 @@ throw (SALOME::SALOME_Exception)
// Create array of identifiers
SMESH::long_array_var aResIds = new SMESH::long_array;
aResIds->length( anIds.Extent() );
aResIds->length( anIds.size() );
NCollection_Map< int >::Iterator anIter( anIds );
for ( int i = 0; anIter.More(); anIter.Next(), i++ )
//NCollection_Map< int >::Iterator anIter( anIds );
for ( int i = 0; i<anIds.size(); i++ )
{
aResIds[ i ] = anIter.Value();
aResIds[ i ] = anIds[i];
}
aResGrp->Add( aResIds );
@ -1130,14 +1130,14 @@ throw (SALOME::SALOME_Exception)
// create map of ids
int nbGrp = theGroups.length();
NCollection_Map< int > anIds;
vector< int > anIds;
NCollection_DataMap< int, int >::Iterator anIter( anIdToCount );
for ( ; anIter.More(); anIter.Next() )
{
int aCurrId = anIter.Key();
int aCurrNb = anIter.Value();
if ( aCurrNb == nbGrp )
anIds.Add( aCurrId );
anIds.push_back( aCurrId );
}
// Create group
@ -1147,12 +1147,12 @@ throw (SALOME::SALOME_Exception)
// Create array of identifiers
SMESH::long_array_var aResIds = new SMESH::long_array;
aResIds->length( anIds.Extent() );
aResIds->length( anIds.size() );
NCollection_Map< int >::Iterator aListIter( anIds );
for ( int i = 0; aListIter.More(); aListIter.Next(), i++ )
//NCollection_Map< int >::Iterator aListIter( anIds );
for ( int i = 0; i<anIds.size(); i++ )
{
aResIds[ i ] = aListIter.Value();
aResIds[ i ] = anIds[i];
}
aResGrp->Add( aResIds );
@ -1249,7 +1249,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutListOfGroups(
try
{
NCollection_Map< int > aToolIds;
set< int > aToolIds;
SMESH::ElementType aType = SMESH::ALL;
int g, n;
// iterate through tool groups
@ -1274,11 +1274,11 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutListOfGroups(
for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
{
int aCurrId = aCurrIds[ i ];
aToolIds.Add( aCurrId );
aToolIds.insert( aCurrId );
}
}
NCollection_Map< int > anIds; // result
vector< int > anIds; // result
// Iterate through main group
for ( g = 0, n = theMainGroups.length(); g < n; g++ )
@ -1302,8 +1302,8 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutListOfGroups(
for ( int i = 0, n = aCurrIds->length(); i < n; i++ )
{
int aCurrId = aCurrIds[ i ];
if ( !aToolIds.Contains( aCurrId ) )
anIds.Add( aCurrId );
if ( !aToolIds.count( aCurrId ) )
anIds.push_back( aCurrId );
}
}
@ -1314,12 +1314,11 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutListOfGroups(
// Create array of identifiers
SMESH::long_array_var aResIds = new SMESH::long_array;
aResIds->length( anIds.Extent() );
aResIds->length( anIds.size() );
NCollection_Map< int >::Iterator anIter( anIds );
for ( int i = 0; anIter.More(); anIter.Next(), i++ )
for (int i=0; i<anIds.size(); i++ )
{
aResIds[ i ] = anIter.Value();
aResIds[ i ] = anIds[i];
}
aResGrp->Add( aResIds );
@ -1371,7 +1370,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateDimGroup(
{
// Create map of nodes from all groups
NCollection_Map< int > aNodeMap;
set< int > aNodeMap;
for ( int g = 0, n = theGroups.length(); g < n; g++ )
{
@ -1390,7 +1389,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateDimGroup(
int aCurrId = aCurrIds[ i ];
const SMDS_MeshNode* aNode = aMeshDS->FindNode( aCurrId );
if ( aNode )
aNodeMap.Add( aNode->GetID() );
aNodeMap.insert( aNode->GetID() );
}
}
else
@ -1408,7 +1407,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateDimGroup(
const SMDS_MeshNode* aNode =
dynamic_cast<const SMDS_MeshNode*>( aNodeIter->next() );
if ( aNode )
aNodeMap.Add( aNode->GetID() );
aNodeMap.insert( aNode->GetID() );
}
}
}
@ -1416,22 +1415,25 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateDimGroup(
// Get result identifiers
NCollection_Map< int > aResultIds;
vector< int > aResultIds;
if ( theElemType == SMESH::NODE )
{
NCollection_Map< int >::Iterator aNodeIter( aNodeMap );
for ( ; aNodeIter.More(); aNodeIter.Next() )
aResultIds.Add( aNodeIter.Value() );
//NCollection_Map< int >::Iterator aNodeIter( aNodeMap );
set<int>::iterator iter = aNodeMap.begin();
for ( ; iter != aNodeMap.end(); iter++ )
aResultIds.push_back( *iter);
}
else
{
// Create list of elements of given dimension constructed on the nodes
NCollection_Map< int > anElemList;
NCollection_Map< int >::Iterator aNodeIter( aNodeMap );
for ( ; aNodeIter.More(); aNodeIter.Next() )
vector< int > anElemList;
//NCollection_Map< int >::Iterator aNodeIter( aNodeMap );
//for ( ; aNodeIter.More(); aNodeIter.Next() )
set<int>::iterator iter = aNodeMap.begin();
for ( ; iter != aNodeMap.end(); iter++ )
{
const SMDS_MeshElement* aNode =
dynamic_cast<const SMDS_MeshElement*>( aMeshDS->FindNode( aNodeIter.Value() ) );
dynamic_cast<const SMDS_MeshElement*>( aMeshDS->FindNode( *iter ) );
if ( !aNode )
continue;
@ -1441,15 +1443,16 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateDimGroup(
const SMDS_MeshElement* anElem =
dynamic_cast<const SMDS_MeshElement*>( anElemIter->next() );
if ( anElem && anElem->GetType() == anElemType )
anElemList.Add( anElem->GetID() );
anElemList.push_back( anElem->GetID() );
}
}
// check whether all nodes of elements are present in nodes map
NCollection_Map< int >::Iterator anIter( anElemList );
for ( ; anIter.More(); anIter.Next() )
//NCollection_Map< int >::Iterator anIter( anElemList );
//for ( ; anIter.More(); anIter.Next() )
for (int i=0; i< anElemList.size(); i++)
{
const SMDS_MeshElement* anElem = aMeshDS->FindElement( anIter.Value() );
const SMDS_MeshElement* anElem = aMeshDS->FindElement( anElemList[i] );
if ( !anElem )
continue;
@ -1459,14 +1462,14 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateDimGroup(
{
const SMDS_MeshNode* aNode =
dynamic_cast<const SMDS_MeshNode*>( aNodeIter->next() );
if ( !aNode || !aNodeMap.Contains( aNode->GetID() ) )
if ( !aNode || !aNodeMap.count( aNode->GetID() ) )
{
isOk = false;
break;
}
}
if ( isOk )
aResultIds.Add( anElem->GetID() );
aResultIds.push_back( anElem->GetID() );
}
}
@ -1478,11 +1481,12 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateDimGroup(
// Create array of identifiers
SMESH::long_array_var aResIds = new SMESH::long_array;
aResIds->length( aResultIds.Extent() );
aResIds->length( aResultIds.size() );
NCollection_Map< int >::Iterator aResIter( aResultIds );
for ( int i = 0; aResIter.More(); aResIter.Next(), i++ )
aResIds[ i ] = aResIter.Value();
//NCollection_Map< int >::Iterator aResIter( aResultIds );
//for ( int i = 0; aResIter.More(); aResIter.Next(), i++ )
for (int i=0; i< aResultIds.size(); i++)
aResIds[ i ] = aResultIds[i];
aResGrp->Add( aResIds );
// Remove strings corresponding to group creation

View File

@ -130,6 +130,7 @@ dist_libStdMeshers_la_SOURCES = \
libStdMeshers_la_CPPFLAGS = \
$(CAS_CPPFLAGS) \
$(BOOST_CPPFLAGS) \
$(VTK_INCLUDES) \
$(KERNEL_CXXFLAGS) \
$(GUI_CXXFLAGS) \
-I$(srcdir)/../SMESHImpl \

View File

@ -117,6 +117,7 @@ libStdMeshersEngine_la_CPPFLAGS = \
$(GEOM_CXXFLAGS) \
$(MED_CXXFLAGS) \
$(BOOST_CPPFLAGS) \
$(VTK_INCLUDES) \
$(CORBA_CXXFLAGS) \
$(CORBA_INCLUDES) \
-I$(srcdir)/../SMESHImpl \