diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index fecef49959c5dbd3b898f15b6baa60e6572bff62..0b1e67901324ca0bbee4cb927829586d7ff43311 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -230,7 +230,7 @@ Foam::polyMesh::polyMesh(const IOobject& io) } else { - cellIOList c + cellIOList cLst ( IOobject ( @@ -243,9 +243,8 @@ Foam::polyMesh::polyMesh(const IOobject& io) ) ); - // Set the primitive mesh - initMesh(c); + initMesh(cLst); owner_.write(); neighbour_.write(); @@ -271,162 +270,6 @@ Foam::polyMesh::polyMesh(const IOobject& io) } -Foam::polyMesh::polyMesh -( - const IOobject& io, - const pointField& points, - const faceList& faces, - const labelList& owner, - const labelList& neighbour, - const bool syncPar -) -: - objectRegistry(io), - primitiveMesh(), - points_ - ( - IOobject - ( - "points", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - points - ), - faces_ - ( - IOobject - ( - "faces", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - faces - ), - owner_ - ( - IOobject - ( - "owner", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - owner - ), - neighbour_ - ( - IOobject - ( - "neighbour", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - neighbour - ), - clearedPrimitives_(false), - boundary_ - ( - IOobject - ( - "boundary", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - *this, - 0 - ), - bounds_(points_, syncPar), - directions_(Vector<label>::zero), - pointZones_ - ( - IOobject - ( - "pointZones", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - *this, - 0 - ), - faceZones_ - ( - IOobject - ( - "faceZones", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - *this, - 0 - ), - cellZones_ - ( - IOobject - ( - "cellZones", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - *this, - 0 - ), - globalMeshDataPtr_(NULL), - moving_(false), - changing_(false), - curMotionTimeIndex_(time().timeIndex()), - oldPointsPtr_(NULL) -{ - // Check if the faces and cells are valid - forAll (faces_, faceI) - { - const face& curFace = faces_[faceI]; - - if (min(curFace) < 0 || max(curFace) > points_.size()) - { - FatalErrorIn - ( - "polyMesh::polyMesh\n" - "(\n" - " const IOobject& io,\n" - " const pointField& points,\n" - " const faceList& faces,\n" - " const cellList& cells\n" - ")\n" - ) << "Face " << faceI << "contains vertex labels out of range: " - << curFace << " Max point index = " << points_.size() - << abort(FatalError); - } - } - - // Set the primitive mesh - initMesh(); -} - - Foam::polyMesh::polyMesh ( const IOobject& io, @@ -583,183 +426,6 @@ Foam::polyMesh::polyMesh } -Foam::polyMesh::polyMesh -( - const IOobject& io, - const pointField& points, - const faceList& faces, - const cellList& cells, - const bool syncPar -) -: - objectRegistry(io), - primitiveMesh(), - points_ - ( - IOobject - ( - "points", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - points - ), - faces_ - ( - IOobject - ( - "faces", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - faces - ), - owner_ - ( - IOobject - ( - "owner", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - 0 - ), - neighbour_ - ( - IOobject - ( - "neighbour", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - 0 - ), - clearedPrimitives_(false), - boundary_ - ( - IOobject - ( - "boundary", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - *this, - 0 - ), - bounds_(points_, syncPar), - directions_(Vector<label>::zero), - pointZones_ - ( - IOobject - ( - "pointZones", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - *this, - 0 - ), - faceZones_ - ( - IOobject - ( - "faceZones", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - *this, - 0 - ), - cellZones_ - ( - IOobject - ( - "cellZones", - instance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - *this, - 0 - ), - globalMeshDataPtr_(NULL), - moving_(false), - changing_(false), - curMotionTimeIndex_(time().timeIndex()), - oldPointsPtr_(NULL) -{ - // Check if the faces and cells are valid - forAll (faces_, faceI) - { - const face& curFace = faces_[faceI]; - - if (min(curFace) < 0 || max(curFace) > points_.size()) - { - FatalErrorIn - ( - "polyMesh::polyMesh\n" - "(\n" - " const IOobject& io,\n" - " const pointField& points,\n" - " const faceList& faces,\n" - " const cellList& cells\n" - ")\n" - ) << "Face " << faceI << "contains vertex labels out of range: " - << curFace << " Max point index = " << points_.size() - << abort(FatalError); - } - } - - // Check if the faces and cells are valid - forAll (cells, cellI) - { - const cell& curCell = cells[cellI]; - - if (min(curCell) < 0 || max(curCell) > faces_.size()) - { - FatalErrorIn - ( - "polyMesh::polyMesh\n" - "(\n" - " const IOobject& io,\n" - " const pointField& points,\n" - " const faceList& faces,\n" - " const cellList& cells\n" - ")\n" - ) << "Cell " << cellI << "contains face labels out of range: " - << curCell << " Max face index = " << faces_.size() - << abort(FatalError); - } - } - - // Set the primitive mesh - initMesh(const_cast<cellList&>(cells)); -} - - Foam::polyMesh::polyMesh ( const IOobject& io, @@ -910,7 +576,8 @@ Foam::polyMesh::polyMesh } } - const cellList& cLst = cells(); + // transfer in cell list + cellList cLst(cells); // Check if cells are valid forAll (cLst, cellI) @@ -935,7 +602,7 @@ Foam::polyMesh::polyMesh } // Set the primitive mesh - initMesh(cells); + initMesh(cLst); } @@ -1019,8 +686,8 @@ void Foam::polyMesh::resetPrimitives } - // Set the primitive mesh from the owner_, neighbour_. Works - // out from patch end where the active faces stop. + // Set the primitive mesh from the owner_, neighbour_. + // Works out from patch end where the active faces stop. initMesh(); diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.H b/src/OpenFOAM/meshes/polyMesh/polyMesh.H index a888420eda17e4f9d9d2deacc805ff8d3c22da0d..19ce87c2f0501f18a6cedb74058ffcf0a8c2038c 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.H @@ -116,8 +116,8 @@ private: //- Boundary mesh mutable polyBoundaryMesh boundary_; - //- Mesh bounding-box. created from points on construction - // and updated when the mesh moves + //- Mesh bounding-box. + // Created from points on construction, updated when the mesh moves boundBox bounds_; //- vector of valid directions in mesh @@ -170,9 +170,6 @@ private: //- Initialise the polyMesh from the given set of cells void initMesh(cellList& c); - //- Initialise the polyMesh from the given set of cells - void initMesh(const xfer<cellList>& c); - //- Calculate the valid directions in the mesh from the boundaries void calcDirections() const; @@ -217,18 +214,6 @@ public: //- Construct from IOobject explicit polyMesh(const IOobject& io); - //- Construct without boundary from components. - // Boundary is added using addPatches() member function - polyMesh - ( - const IOobject& io, - const pointField& points, - const faceList& faces, - const labelList& owner, - const labelList& neighbour, - const bool syncPar = true - ); - //- Construct without boundary from components. // Boundary is added using addPatches() member function polyMesh @@ -241,17 +226,6 @@ public: const bool syncPar = true ); - //- Construct without boundary with cells rather than owner/neighbour. - // Boundary is added using addPatches() member function - polyMesh - ( - const IOobject& io, - const pointField& points, - const faceList& faces, - const cellList& cells, - const bool syncPar = true - ); - //- Construct without boundary with cells rather than owner/neighbour. // Boundary is added using addPatches() member function polyMesh @@ -267,7 +241,7 @@ public: polyMesh ( const IOobject& io, - const pointField& points, + const xfer<pointField>& points, const cellShapeList& shapes, const faceListList& boundaryFaces, const wordList& boundaryPatchNames, diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C index 4818d3009c2e7f8eaa0ba48015fdaf24acf0d8f8..19418a23114dcf02aa3c7c1e56b29de242a5afc2 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C @@ -39,7 +39,7 @@ Foam::labelListList Foam::polyMesh::cellShapePointCells const cellShapeList& c ) const { - List<DynamicList<label, primitiveMesh::cellsPerPoint_> > + List<DynamicList<label, primitiveMesh::cellsPerPoint_> > pc(points().size()); // For each cell @@ -136,7 +136,7 @@ Foam::labelList Foam::polyMesh::facePatchFaceCells Foam::polyMesh::polyMesh ( const IOobject& io, - const pointField& points, + const xfer<pointField>& points, const cellShapeList& cellsAsShapes, const faceListList& boundaryFaces, const wordList& boundaryPatchNames, @@ -311,7 +311,7 @@ Foam::polyMesh::polyMesh // Insertion cannot be done in one go as the faces need to be // added into the list in the increasing order of neighbour // cells. Therefore, all neighbours will be detected first - // and then added in the correct order. + // and then added in the correct order. const faceList& curFaces = cellsFaceShapes[cellI]; @@ -414,8 +414,8 @@ Foam::polyMesh::polyMesh ( "polyMesh::polyMesh\n" "(\n" - " const IOobject& io,\n" - " const pointField& points,\n" + " const IOobject&,\n" + " const xfer<pointField>&,\n" " const cellShapeList& cellsAsShapes,\n" " const faceListList& boundaryFaces,\n" " const wordList& boundaryPatchTypes,\n" @@ -472,8 +472,8 @@ Foam::polyMesh::polyMesh ( "polyMesh::polyMesh\n" "(\n" - " const IOobject& io,\n" - " const pointField& points,\n" + " const IOobject&,\n" + " const xfer<pointField>&,\n" " const cellShapeList& cellsAsShapes,\n" " const faceListList& boundaryFaces,\n" " const wordList& boundaryPatchTypes,\n" diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshInitMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMeshInitMesh.C index d4d74ee22da68f58cc95ae133c9d46a23f0ccf05..b3baa5335ee6cd957cd11dd8fae459008897d91f 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshInitMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshInitMesh.C @@ -154,11 +154,4 @@ void Foam::polyMesh::initMesh(cellList& c) neighbour_.note() = meshInfo; } - -void Foam::polyMesh::initMesh(const xfer<cellList>& clst) -{ - initMesh(clst()); -} - - // ************************************************************************* // diff --git a/src/conversion/meshReader/meshReader.C b/src/conversion/meshReader/meshReader.C index d35429c8dbbc05ebb6c69ce54b725b5a9f01a326..95447f904ed53ec0163aa9187e485737b8dee73b 100644 --- a/src/conversion/meshReader/meshReader.C +++ b/src/conversion/meshReader/meshReader.C @@ -142,9 +142,9 @@ Foam::autoPtr<Foam::polyMesh> Foam::meshReader::mesh "constant", registry ), - points_, - meshFaces_, - cellPolys_ + xferMove(points_), + xferMove(meshFaces_), + xferMove(cellPolys_) ) ); @@ -166,14 +166,7 @@ void Foam::meshReader::writeMesh IOstream::streamFormat fmt ) const { - fileName meshDir = mesh.objectRegistry::path()/mesh.meshDir(); - - // remove some directories and files - this should be easier - mesh.removeFiles(mesh.instance()); - if (dir(meshDir/"sets")) - { - rmDir(meshDir/"sets"); - } + mesh.removeFiles(); Info<< "Writing polyMesh" << endl; mesh.writeObject diff --git a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C index 36227bd2672cad75aac24b53205cb89db8bba9bd..3adafa0dfab9e907af7a61f65f64575b3f243309 100644 --- a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C +++ b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C @@ -1398,10 +1398,10 @@ Foam::autoPtr<Foam::polyMesh> Foam::polyMeshAdder::add new polyMesh ( io, - allPoints, - allFaces, - allOwner, - allNeighbour + xferMove(allPoints), + xferMove(allFaces), + xferMove(allOwner), + xferMove(allNeighbour) ) ); polyMesh& mesh = tmesh(); diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C index de5124ea07ac61a8bb157492dfd9f60595aca667..d8611fae137ca2c902147e1731616468a7cf3adf 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C @@ -2097,29 +2097,20 @@ Foam::polyTopoChange::polyTopoChange void Foam::polyTopoChange::clear() { - points_.clear(); - points_.setSize(0); - pointMap_.clear(); - pointMap_.setSize(0); - reversePointMap_.clear(); - reversePointMap_.setSize(0); + points_.clearStorage(); + pointMap_.clearStorage(); + reversePointMap_.clearStorage(); pointZone_.clear(); pointZone_.resize(0); retiredPoints_.clear(); retiredPoints_.resize(0); - faces_.clear(); - faces_.setSize(0); - region_.clear(); - region_.setSize(0); - faceOwner_.clear(); - faceOwner_.setSize(0); - faceNeighbour_.clear(); - faceNeighbour_.setSize(0); - faceMap_.clear(); - faceMap_.setSize(0); - reverseFaceMap_.clear(); - reverseFaceMap_.setSize(0); + faces_.clearStorage(); + region_.clearStorage(); + faceOwner_.clearStorage(); + faceNeighbour_.clearStorage(); + faceMap_.clearStorage(); + reverseFaceMap_.clearStorage(); faceFromPoint_.clear(); faceFromPoint_.resize(0); faceFromEdge_.clear(); @@ -2132,12 +2123,9 @@ void Foam::polyTopoChange::clear() faceZoneFlip_.resize(0); nActiveFaces_ = 0; - cellMap_.clear(); - cellMap_.setSize(0); - reverseCellMap_.clear(); - reverseCellMap_.setSize(0); - cellZone_.clear(); - cellZone_.setSize(0); + cellMap_.clearStorage(); + reverseCellMap_.clearStorage(); + cellZone_.clearStorage(); cellFromPoint_.clear(); cellFromPoint_.resize(0); cellFromEdge_.clear(); diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 8021b09f5590a1bf1da3afedabfa53dce7fe6907..3c2e6756ac4c65f454aee953bdf4604391f8a5f9 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -228,38 +228,6 @@ Foam::fvMesh::fvMesh(const IOobject& io) } -Foam::fvMesh::fvMesh -( - const IOobject& io, - const pointField& points, - const faceList& faces, - const labelList& allOwner, - const labelList& allNeighbour, - const bool syncPar -) -: - polyMesh(io, points, faces, allOwner, allNeighbour, syncPar), - surfaceInterpolation(*this), - boundary_(*this), - lduPtr_(NULL), - curTimeIndex_(time().timeIndex()), - VPtr_(NULL), - V0Ptr_(NULL), - V00Ptr_(NULL), - SfPtr_(NULL), - magSfPtr_(NULL), - CPtr_(NULL), - CfPtr_(NULL), - phiPtr_(NULL) -{ - if (debug) - { - Info<< "Constructing fvMesh from components" - << endl; - } -} - - Foam::fvMesh::fvMesh ( const IOobject& io, @@ -286,39 +254,7 @@ Foam::fvMesh::fvMesh { if (debug) { - Info<< "Constructing fvMesh from components" - << endl; - } -} - - -Foam::fvMesh::fvMesh -( - const IOobject& io, - const pointField& points, - const faceList& faces, - const cellList& cells, - const bool syncPar -) -: - polyMesh(io, points, faces, cells, syncPar), - surfaceInterpolation(*this), - boundary_(*this), - lduPtr_(NULL), - curTimeIndex_(time().timeIndex()), - VPtr_(NULL), - V0Ptr_(NULL), - V00Ptr_(NULL), - SfPtr_(NULL), - magSfPtr_(NULL), - CPtr_(NULL), - CfPtr_(NULL), - phiPtr_(NULL) -{ - if (debug) - { - Info<< "Constructing fvMesh from components" - << endl; + Info<< "Constructing fvMesh from components" << endl; } } @@ -348,8 +284,7 @@ Foam::fvMesh::fvMesh { if (debug) { - Info<< "Constructing fvMesh from components" - << endl; + Info<< "Constructing fvMesh from components" << endl; } } diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index d89b92a82d1d3f5c2fd1e03b592827785b693b41..c685751d227cdc7828b70200262c853d6a7a441f 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -93,7 +93,7 @@ class fvMesh //- Current time index for cell volumes // Note. The whole mechanism will be replaced once the // dimensionedField is created and the dimensionedField - // will take care of the old-time levels. + // will take care of the old-time levels. mutable label curTimeIndex_; //- Cell volumes old time level @@ -168,18 +168,6 @@ public: //- Construct from IOobject explicit fvMesh(const IOobject& io); - //- Construct from components without boundary. - // Boundary is added using addFvPatches() member function - fvMesh - ( - const IOobject& io, - const pointField& points, - const faceList& faces, - const labelList& allOwner, - const labelList& allNeighbour, - const bool syncPar = true - ); - //- Construct from components without boundary. // Boundary is added using addFvPatches() member function fvMesh @@ -192,20 +180,7 @@ public: const bool syncPar = true ); - //- Construct from components with cells rather than owner - // and neighbourwithout boundary. - // Boundary is added using addPatches() member function - fvMesh - ( - const IOobject& io, - const pointField& points, - const faceList& faces, - const cellList& cells, - const bool syncPar = true - ); - - //- Construct from components with cells rather than owner - // and neighbourwithout boundary. + //- Construct without boundary from cells rather than owner/neighbour. // Boundary is added using addPatches() member function fvMesh ( @@ -252,7 +227,7 @@ public: return *this; } - //- Return reference to name + //- Return reference to name // Note: name() is currently ambiguous due to derivation from // surfaceInterpolation const word& name() const