while ( aMinStr.Search( "-" ) != -1 ) aMinStr.RemoveAll( '-' );
while ( aMaxStr.Search( "-" ) != -1 ) aMaxStr.RemoveAll( '-' );
- if ( !aMinStr.IsEmpty() && !aMinStr.IsIntegerValue() ||
- !aMaxStr.IsEmpty() && !aMaxStr.IsIntegerValue() )
+ if ( (!aMinStr.IsEmpty() && !aMinStr.IsIntegerValue()) ||
+ (!aMaxStr.IsEmpty() && !aMaxStr.IsIntegerValue()) )
return false;
myMin.Append( aMinStr.IsEmpty() ? IntegerFirst() : aMinStr.IntegerValue() );
else
{
const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
- if ( anElem == 0 || myType != anElem->GetType() && myType != SMDSAbs_All )
+ if ( anElem == 0 || (myType != anElem->GetType() && myType != SMDSAbs_All ))
return false;
}
return
myPredicate1 &&
myPredicate2 &&
- myPredicate1->IsSatisfy( theId ) ||
- myPredicate2->IsSatisfy( theId );
+ (myPredicate1->IsSatisfy( theId ) ||
+ myPredicate2->IsSatisfy( theId ));
}
if ( aMeshDimension == 2 && anIsZDimension ) // 2D only if mesh is in XOY plane
aMeshDimension = 3;
// PAL18941(a saved study with a mesh belong Z is opened and the mesh is belong X)
- if ( aMeshDimension == 1 && !anIsXDimension ) // 1D only if mesh is along OX
+ if ( aMeshDimension == 1 && !anIsXDimension ) {// 1D only if mesh is along OX
if ( anIsYDimension ) {
aMeshDimension = 2;
anIsXDimension = true;
} else {
aMeshDimension = 3;
}
+ }
}
SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator(/*idInceasingOrder=*/true);
int myFacesDefaultFamilyId = 0;
int myVolumesDefaultFamilyId = 0;
int nbNodes = myMesh->NbNodes();
- int nb0DElements = myMesh->Nb0DElements();
+ //int nb0DElements = myMesh->Nb0DElements();
int nbEdges = myMesh->NbEdges();
int nbFaces = myMesh->NbFaces();
int nbVolumes = myMesh->NbVolumes();
int nbNodes = anElem->NbNodes();
- if ( theEdgeNum < 0 || theEdgeNum > 3 || nbNodes != 3 && nbNodes != 4 || theEdgeNum > nbNodes )
+ if ( theEdgeNum < 0 || theEdgeNum > 3 || (nbNodes != 3 && nbNodes != 4) || theEdgeNum > nbNodes )
return false;
vector<int> anIds( nbNodes );
myEmptyGrid->BuildLinks();
}
myGrid->ShallowCopy(myEmptyGrid);
+ return true;
}
//=================================================================================
// function : GetElemDimension
{
int volId = _grid->CellIdToDownId(vtkId);
SMDS_Downward * downvol = _grid->getDownArray(vtkType);
- const int *downIds = downvol->getDownCells(volId);
+ //const int *downIds = downvol->getDownCells(volId);
const unsigned char* downTypesVol = downvol->getDownTypes(volId);
int nbFaces = downvol->getNumberOfDownCells(volId);
const int* faceIds = downvol->getDownCells(volId);
//MESSAGE("Add0DElementWithID" << ID)
SMDS_Mesh0DElement * el0d = new SMDS_Mesh0DElement(n);
if (myElementIDFactory->BindID(ID, el0d)) {
- SMDS_MeshNode *node = const_cast<SMDS_MeshNode*>(n);
+ //SMDS_MeshNode *node = const_cast<SMDS_MeshNode*>(n);
//node->AddInverseElement(el0d);// --- fait avec BindID
adjustmyCellsCapacity(ID);
myCells[ID] = el0d;
//MESSAGE("SMDS_Mesh::RemoveElement " << elem->getVtkId() << " " << removenodes);
// get finite elements built on elem
set<const SMDS_MeshElement*> * s1;
- if (elem->GetType() == SMDSAbs_0DElement || elem->GetType() == SMDSAbs_Edge && !hasConstructionEdges()
- || elem->GetType() == SMDSAbs_Face && !hasConstructionFaces() || elem->GetType() == SMDSAbs_Volume)
+ 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*> ();
s1->insert(elem);
#include "SMDS_Mesh.hxx"
#include <vtkUnstructuredGrid.h>
-#define protected public
-#include <vtkCellLinks.h>
-#define protected protected
-
#include "utilities.h"
#include "Utils_SALOME_Exception.hxx"
#include <cassert>
myIdInShape = -1;
//MESSAGE("Node " << myID << " " << myVtkID << " (" << x << ", " << y << ", " << z << ")");
SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId];
- vtkUnstructuredGrid * grid = mesh->getGrid();
+ SMDS_UnstructuredGrid * grid = mesh->getGrid();
vtkPoints *points = grid->GetPoints();
points->InsertPoint(myVtkID, x, y, z);
- vtkCellLinks *cellLinks = grid->GetCellLinks();
- if (myVtkID >=cellLinks->Size)
- cellLinks->Resize(myVtkID+SMDS_Mesh::chunkSize);
+ SMDS_CellLinks *cellLinks = dynamic_cast<SMDS_CellLinks*>(grid->GetCellLinks());
+ assert(cellLinks);
+ if (myVtkID >= cellLinks->GetLinksSize())
+ cellLinks->ResizeL(myVtkID+SMDS_Mesh::chunkSize);
}
SMDS_MeshNode::~SMDS_MeshNode()
using namespace std;
+SMDS_CellLinks* SMDS_CellLinks::New()
+{
+ MESSAGE("SMDS_CellLinks::New");
+ return new SMDS_CellLinks();
+}
+
+vtkCellLinks::Link* SMDS_CellLinks::ResizeL(vtkIdType sz)
+{
+ return vtkCellLinks::Resize(sz);
+}
+
+vtkIdType SMDS_CellLinks::GetLinksSize()
+{
+ return this->Size;
+}
+
+SMDS_CellLinks::SMDS_CellLinks() :
+ vtkCellLinks()
+{
+}
+
+SMDS_CellLinks::~SMDS_CellLinks()
+{
+}
+
SMDS_UnstructuredGrid* SMDS_UnstructuredGrid::New()
{
MESSAGE("SMDS_UnstructuredGrid::New");
int faceId2 = downFaces[idf];
int faceType = downTypes[idf];
//ASSERT(_downArray[faceType]);
- SMDS_Down2D* downFace2 = static_cast<SMDS_Down2D*> (_downArray[faceType]);
+ //SMDS_Down2D* downFace2 = static_cast<SMDS_Down2D*> (_downArray[faceType]);
_downArray[vtkEdgeType]->addUpCell(connEdgeId, faceId2, faceType);
_downArray[faceType]->addDownCell(faceId2, connEdgeId, vtkEdgeType);
// MESSAGE(" From face t:" << vtkFaceType << " " << faceId <<
return orderedNodes.size();
}
+void SMDS_UnstructuredGrid::BuildLinks()
+{
+ // Remove the old links if they are already built
+ if (this->Links)
+ {
+ this->Links->UnRegister(this);
+ }
+
+ this->Links = SMDS_CellLinks::New();
+ this->Links->Allocate(this->GetNumberOfPoints());
+ this->Links->Register(this);
+ this->Links->BuildLinks(this, this->Connectivity);
+ this->Links->Delete();
+}
#define _SMDS_UNSTRUCTUREDGRID_HXX
#include <vtkUnstructuredGrid.h>
+#include <vtkCellLinks.h>
#include "chrono.hxx"
#include <vector>
class SMDS_Downward;
class SMDS_Mesh;
+class SMDS_CellLinks: public vtkCellLinks
+{
+public:
+ vtkCellLinks::Link* ResizeL(vtkIdType sz);
+ vtkIdType GetLinksSize();
+ static SMDS_CellLinks* New();
+protected:
+ SMDS_CellLinks();
+ ~SMDS_CellLinks();
+};
+
class SMDS_UnstructuredGrid: public vtkUnstructuredGrid
{
public:
void GetNodeIds(std::set<int>& nodeSet, int downId, unsigned char downType);
void ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds);
int getOrderedNodesOfFace(int vtkVolId, std::vector<int>& orderedNodes);
+ void BuildLinks();
vtkCellLinks* GetLinks()
{
return Links;
default:
break;
}
+ return true;
}
SMDS_VtkVolume::~SMDS_VtkVolume()
/*! polyhedron only,
* return number of nodes for each face
*/
-const std::vector<int> & SMDS_VtkVolume::GetQuantities() const
+const std::vector<int> SMDS_VtkVolume::GetQuantities() const
{
vector<int> quantities;
quantities.clear();
static bool isForward(double* a,double* b,double* c,double* d);
int NbUniqueNodes() const;
SMDS_ElemIteratorPtr uniqueNodesIterator() const;
- const std::vector<int> & GetQuantities() const;
+ const std::vector<int> GetQuantities() const;
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
SMESHDS_Mesh* mesh = GetMeshDS();
switch ( type ) {
case SMDSAbs_0DElement:
- if ( nbnode == 1 )
+ if ( nbnode == 1 ) {
if ( ID >= 0 ) e = mesh->Add0DElementWithID(node[0], ID);
else e = mesh->Add0DElement (node[0] );
+ }
break;
case SMDSAbs_Edge:
- if ( nbnode == 2 )
+ if ( nbnode == 2 ) {
if ( ID >= 0 ) e = mesh->AddEdgeWithID(node[0], node[1], ID);
else e = mesh->AddEdge (node[0], node[1] );
- else if ( nbnode == 3 )
+ }
+ else if ( nbnode == 3 ) {
if ( ID >= 0 ) e = mesh->AddEdgeWithID(node[0], node[1], node[2], ID);
else e = mesh->AddEdge (node[0], node[1], node[2] );
+ }
break;
case SMDSAbs_Face:
if ( !isPoly ) {
- if (nbnode == 3)
+ if (nbnode == 3) {
if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], ID);
else e = mesh->AddFace (node[0], node[1], node[2] );
- else if (nbnode == 4)
+ }
+ else if (nbnode == 4) {
if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3], ID);
else e = mesh->AddFace (node[0], node[1], node[2], node[3] );
- else if (nbnode == 6)
+ }
+ else if (nbnode == 6) {
if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3],
node[4], node[5], ID);
else e = mesh->AddFace (node[0], node[1], node[2], node[3],
node[4], node[5] );
- else if (nbnode == 8)
+ }
+ else if (nbnode == 8) {
if ( ID >= 0 ) e = mesh->AddFaceWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7], ID);
else e = mesh->AddFace (node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7] );
+ }
} else {
if ( ID >= 0 ) e = mesh->AddPolygonalFaceWithID(node, ID);
else e = mesh->AddPolygonalFace (node );
break;
case SMDSAbs_Volume:
if ( !isPoly ) {
- if (nbnode == 4)
+ if (nbnode == 4) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], ID);
else e = mesh->AddVolume (node[0], node[1], node[2], node[3] );
- else if (nbnode == 5)
+ }
+ else if (nbnode == 5) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], ID);
else e = mesh->AddVolume (node[0], node[1], node[2], node[3],
node[4] );
- else if (nbnode == 6)
+ }
+ else if (nbnode == 6) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], ID);
else e = mesh->AddVolume (node[0], node[1], node[2], node[3],
node[4], node[5] );
- else if (nbnode == 8)
+ }
+ else if (nbnode == 8) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7], ID);
else e = mesh->AddVolume (node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7] );
- else if (nbnode == 10)
+ }
+ else if (nbnode == 10) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7],
node[8], node[9], ID);
else e = mesh->AddVolume (node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7],
node[8], node[9] );
- else if (nbnode == 13)
+ }
+ else if (nbnode == 13) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11],
node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11],
node[12] );
- else if (nbnode == 15)
+ }
+ else if (nbnode == 15) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11],
node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11],
node[12],node[13],node[14] );
- else if (nbnode == 20)
+ }
+ else if (nbnode == 20) {
if ( ID >= 0 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11],
node[8], node[9], node[10],node[11],
node[12],node[13],node[14],node[15],
node[16],node[17],node[18],node[19] );
+ }
}
}
if ( e ) myLastCreatedElems.Append( e );
// find indices of 1,2 and of A,B in theTria1
int iA = 0, iB = 0, i1 = 0, i2 = 0;
for ( i = 0; i < 6; i++ ) {
- if ( sameInd [ i ] == 0 )
+ if ( sameInd [ i ] == 0 ) {
if ( i < 3 ) i1 = i;
else i2 = i;
- else if (i < 3)
+ }
+ else if (i < 3) {
if ( iA ) iB = i;
else iA = i;
+ }
}
// nodes 1 and 2 should not be the same
if ( aNodes[ i1 ] == aNodes[ i2 ] )
it = theNode2->GetInverseElementIterator(SMDSAbs_Face);
while (it->more()) {
const SMDS_MeshElement* elem = it->next();
- if ( emap.find( elem ) != emap.end() )
+ if ( emap.find( elem ) != emap.end() ) {
if ( theTria1 ) {
// theTria1 must be element with minimum ID
if( theTria1->GetID() < elem->GetID() ) {
else {
theTria1 = elem;
}
+ }
}
return ( theTria1 && theTria2 );
}
int i = 0, iDiag = -1;
while ( it->more()) {
const SMDS_MeshElement *n = it->next();
- if ( n == n1 || n == n2 )
+ if ( n == n1 || n == n2 ) {
if ( iDiag < 0)
iDiag = i;
else {
nFirst[ t ] = n;
break;
}
+ }
i++;
}
}
// Regular elements
int* i = index[ FORWARD ];
- if ( needReverse && nbNodes > 2) // reverse mirrored faces and volumes
+ if ( needReverse && nbNodes > 2) {// reverse mirrored faces and volumes
if ( elemType == SMDSAbs_Face )
i = index[ REV_FACE ];
else
i = index[ nbNodes - 4 ];
-
+ }
if(elem->IsQuadratic()) {
static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
i = anIds;
vector<const SMDS_MeshNode*> nodeList;
SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
- if ( element->IsQuadratic() )
+ if ( element->IsQuadratic() ) {
if (const SMDS_VtkFace* f=dynamic_cast<const SMDS_VtkFace*>(element))
nodeIt = f->interlacedNodesElemIterator();
else if (const SMDS_VtkEdge* e =dynamic_cast<const SMDS_VtkEdge*>(element))
nodeIt = e->interlacedNodesElemIterator();
-
+ }
while ( nodeIt->more() )
{
const SMDS_MeshNode* node = cast2Node( nodeIt->next() );
}
}
else {
- int elemId = elem->GetID();
+ //int elemId = elem->GetID();
//MESSAGE("Change regular element or polygon " << elemId);
SMDSAbs_ElementType etyp = elem->GetType();
uniqueNodes.resize(nbUniqueNodes);
{
if ( uvOK[0] && uvOK[1] )
{
- if ( IsDegenShape( n1->getshapeId() ))
+ if ( IsDegenShape( n1->getshapeId() )) {
if ( myParIndex & U_periodic ) uv[0].SetCoord( 1, uv[1].Coord( 1 ));
else uv[0].SetCoord( 2, uv[1].Coord( 2 ));
- else if ( IsDegenShape( n2->getshapeId() ))
+ }
+ else if ( IsDegenShape( n2->getshapeId() )) {
if ( myParIndex & U_periodic ) uv[1].SetCoord( 1, uv[0].Coord( 1 ));
else uv[1].SetCoord( 2, uv[0].Coord( 2 ));
+ }
TopLoc_Location loc;
Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
return
aMesh->GetMeshDS()->ShapeToIndex( shape ) ||
// PAL16202
- shape.ShapeType() == TopAbs_COMPOUND && aMesh->GetMeshDS()->IsGroupOfSubShapes( shape );
+ (shape.ShapeType() == TopAbs_COMPOUND && aMesh->GetMeshDS()->IsGroupOfSubShapes( shape ));
}
//================================================================================
// propagate from quadrangle to neighbour faces
if ( link->MediumPos() >= pos ) {
int nbLinkFaces = link->_faces.size();
- if ( nbLinkFaces == 4 || nbLinkFaces < 4 && link->OnBoundary()) {
+ if ( nbLinkFaces == 4 || (nbLinkFaces < 4 && link->OnBoundary())) {
// hexahedral mesh or boundary quadrangles - goto a continous face
if ( const QFace* f = link->GetContinuesFace( this ))
return f->GetLinkChain( *chLink, chain, pos, error );
ComputeSubMeshStateEngine( CHECK_COMPUTE_STATE );
break;
case CHECK_COMPUTE_STATE:
- if ( !IsMeshComputed() )
+ if ( !IsMeshComputed() ) {
if (_algoState == HYP_OK)
_computeState = READY_TO_COMPUTE;
else
_computeState = NOT_READY;
+ }
break;
default:
ASSERT(0);
MyIterator(SMDSAbs_ElementType type, const SMESHDS_SubMesh* subMesh)
: myType(type), myElem(0)
{
- if ( subMesh )
+ if ( subMesh ) {
if ( myType == SMDSAbs_Node )
myNodeIt = subMesh->GetNodes();
else {
myElemIt = subMesh->GetElements();
next();
}
+ }
}
bool more()
{
map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find( Index );
if ( it != myShapeIndexToSubMesh.end() )
- if ( elem->GetType() == SMDSAbs_Node )
- it->second->RemoveNode( static_cast<const SMDS_MeshNode* >( elem ), /*deleted=*/false );
- else
- it->second->RemoveElement( elem, /*deleted=*/false );
+ {
+ if (elem->GetType() == SMDSAbs_Node)
+ it->second->RemoveNode(static_cast<const SMDS_MeshNode*> (elem), /*deleted=*/false);
+ else
+ it->second->RemoveElement(elem, /*deleted=*/false);
+ }
}
//=======================================================================
// if (!isNodeDeleted) // alive node has valid ID and can be found
// {
int idInSubShape = N->getIdInShape();
- int shapeId = N->getshapeId();
+ //int shapeId = N->getshapeId();
//MESSAGE("in "<< myIndex << " RemoveNode " << shapeId << " " << idInSubShape << " " << N->GetID());
SMDS_MeshNode* node = (SMDS_MeshNode*) (N);
node->setShapeId(0);
VB = quad.side[0]->LastVertex();
int a1, b1, c1, a2, b2, c2;
- if (VA.IsSame(V0))
+ if (VA.IsSame(V0)) {
if (VB.IsSame(V1))
{
a1 = 1;
b2 = 0;
c2 = 0; // x
}
- if (VA.IsSame(V1))
+ }
+ if (VA.IsSame(V1)) {
if (VB.IsSame(V2))
{
a1 = 0;
b2 = 1;
c2 = 0; // y
}
- if (VA.IsSame(V2))
+ }
+ if (VA.IsSame(V2)) {
if (VB.IsSame(V3))
{
a1 = -1;
b2 = 0;
c2 = 1; // 1-x
}
- if (VA.IsSame(V3))
+ }
+ if (VA.IsSame(V3)) {
if (VB.IsSame(V0))
{
a1 = 0;
b2 = -1;
c2 = 1; // 1-y
}
+ }
// MESSAGE("X = " << c1 << "+ " << a1 << "*x + " << b1 << "*y");
// MESSAGE("Y = " << c2 << "+ " << a2 << "*x + " << b2 << "*y");
conv.a1 = a1;
}
if ( hyp1D ) // try to compute with hyp1D
{
- if ( !TNodeDistributor::GetDistributor(*mesh)->Compute( myLayerPositions,p1,p2,*mesh,hyp1D ))
+ if ( !TNodeDistributor::GetDistributor(*mesh)->Compute( myLayerPositions,p1,p2,*mesh,hyp1D )) {
if ( myDistributionHypo ) { // bad hyp assigned
return error( TNodeDistributor::GetDistributor(*mesh)->GetComputeError() );
}
else {
// bad hyp found, its Ok, lets try with default nb of segnents
}
+ }
}
if ( myLayerPositions.empty() ) // try to use nb of layers