-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add patch for SMDS * enable tests for mac * Remove semicolon
- Loading branch information
Showing
3 changed files
with
102 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
diff --git a/src/SMDS/SMDS_ElementFactory.cxx b/src/SMDS/SMDS_ElementFactory.cxx | ||
index c3ab97c..5430921 100644 | ||
--- a/src/SMDS/SMDS_ElementFactory.cxx | ||
+++ b/src/SMDS/SMDS_ElementFactory.cxx | ||
@@ -524,9 +524,9 @@ SMDS_ElementChunk::SMDS_ElementChunk( SMDS_ElementFactory* factory, smIdType id0 | ||
if ( !myFactory ) | ||
return; | ||
if ( myFactory->myIsNodal ) | ||
- myElements = new SMDS_MeshNode[ theChunkSize ]; | ||
+ myNodeElements.resize(theChunkSize); | ||
else | ||
- myElements = new SMDS_MeshCell[ theChunkSize ]; | ||
+ myCellElements.resize(theChunkSize); | ||
|
||
myUsedRanges.mySet.reserve(2); | ||
mySubIDRanges.mySet.insert( _ShapeIDRange( 0, 0 )); | ||
@@ -542,7 +542,7 @@ SMDS_ElementChunk::SMDS_ElementChunk( SMDS_ElementFactory* factory, smIdType id0 | ||
|
||
SMDS_ElementChunk::~SMDS_ElementChunk() | ||
{ | ||
- delete [] myElements; | ||
+ // delete [] myElements; | ||
myFactory->myChunksWithUnused.erase( this ); | ||
} | ||
|
||
diff --git a/src/SMDS/SMDS_ElementFactory.hxx b/src/SMDS/SMDS_ElementFactory.hxx | ||
index dcc00a3..cb216fd 100644 | ||
--- a/src/SMDS/SMDS_ElementFactory.hxx | ||
+++ b/src/SMDS/SMDS_ElementFactory.hxx | ||
@@ -26,6 +26,7 @@ | ||
#define _SMDS_ElementFactory_HeaderFile | ||
|
||
#include "SMDS_MeshCell.hxx" | ||
+#include "SMDS_MeshNode.hxx" | ||
#include "SMDS_Position.hxx" | ||
|
||
#include <Utils_SALOME_Exception.hxx> | ||
@@ -371,7 +372,10 @@ typedef double TParam; | ||
class SMDS_ElementChunk | ||
{ | ||
SMDS_ElementFactory* myFactory; // holder of this chunk | ||
- SMDS_MeshElement* myElements; // array of elements | ||
+ // SMDS_MeshElement* myElements; // array of elements | ||
+ std::vector<SMDS_MeshNode> myNodeElements; // array of node elements | ||
+ std::vector<SMDS_MeshCell> myCellElements; // array of cell elements | ||
+ | ||
smIdType my1stID; // ID of myElements[0] | ||
TBitSet myMarkedSet; // mark some elements | ||
TUsedRangeSet myUsedRanges; // ranges of used/unused elements | ||
@@ -387,10 +391,25 @@ public: | ||
~SMDS_ElementChunk(); | ||
|
||
//! Return an element by an index [0,ChunkSize()] | ||
- SMDS_MeshElement* Element(int index) { return & myElements[index]; } | ||
+ // SMDS_MeshElement* Element(int index) { return & myElements[index]; } | ||
+ SMDS_MeshElement* Element(int index) | ||
+ { | ||
+ if (!myNodeElements.empty()) | ||
+ return &myNodeElements[index]; | ||
+ else | ||
+ return &myCellElements[index]; | ||
+ } | ||
|
||
//! Return an element by an index [0,ChunkSize()] | ||
- const SMDS_MeshElement* Element(int index) const { return & myElements[index]; } | ||
+ // const SMDS_MeshElement* Element(int index) const { return & myElements[index]; } | ||
+ const SMDS_MeshElement* Element(int index) const | ||
+ { | ||
+ if (!myNodeElements.empty()) | ||
+ return &myNodeElements[index]; | ||
+ else | ||
+ return &myCellElements[index]; | ||
+ } | ||
+ | ||
|
||
//! Return ID of the first non-used element | ||
smIdType GetUnusedID() const; | ||
@@ -405,7 +424,14 @@ public: | ||
static bool IsUsed( const _UsedRange& r ) { return r.myValue; } | ||
|
||
//! Return index of an element in the chunk | ||
- int Index( const SMDS_MeshElement* e ) const { return (int)( e - myElements ); } | ||
+ // int Index( const SMDS_MeshElement* e ) const { return (int)( e - myElements ); } | ||
+ int Index( const SMDS_MeshElement* e ) const | ||
+ { | ||
+ if (!myNodeElements.empty()) | ||
+ return (int)( static_cast<const SMDS_MeshNode*>(e) - myNodeElements.data() ); | ||
+ else | ||
+ return (int)( static_cast<const SMDS_MeshCell*>(e) - myCellElements.data() ); | ||
+ } | ||
|
||
//! Return ID of the 1st element in the chunk | ||
smIdType Get1stID() const { return my1stID; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters