1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "primitiveMesh.H"
28 #include "demandDrivenData.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 defineTypeNameAndDebug(Foam::primitiveMesh, 0);
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 Foam::primitiveMesh::primitiveMesh()
63 cellCentresPtr_(NULL),
64 faceCentresPtr_(NULL),
65 cellVolumesPtr_(NULL),
70 // Construct from components
71 // WARNING: ASSUMES CORRECT ORDERING OF DATA.
72 Foam::primitiveMesh::primitiveMesh
75 const label nInternalFaces,
82 nInternalFaces_(nInternalFaces),
104 cellCentresPtr_(NULL),
105 faceCentresPtr_(NULL),
106 cellVolumesPtr_(NULL),
111 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
113 Foam::primitiveMesh::~primitiveMesh()
119 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 void Foam::primitiveMesh::reset
124 const label nInternalFaces,
134 nInternalFaces_ = nInternalFaces;
140 Pout<< "primitiveMesh::reset : mesh reset to"
141 << " nPoints:" << nPoints_
142 << " nEdges:" << nEdges_
143 << " nInternalFaces:" << nInternalFaces_
144 << " nFaces:" << nFaces_
145 << " nCells:" << nCells_
151 void Foam::primitiveMesh::reset
154 const label nInternalFaces,
168 cfPtr_ = new cellList(clst, true);
172 void Foam::primitiveMesh::reset
175 const label nInternalFaces,
178 const Xfer<cellList>& clst
189 cfPtr_ = new cellList(clst);
193 Foam::tmp<Foam::scalarField> Foam::primitiveMesh::movePoints
195 const pointField& newPoints,
196 const pointField& oldPoints
199 if (newPoints.size() < nPoints() || oldPoints.size() < nPoints())
203 "primitiveMesh::movePoints(const pointField& newPoints, "
204 "const pointField& oldPoints)"
205 ) << "Cannot move points: size of given point list smaller "
206 << "than the number of active points" << nl
207 << "newPoints: " << newPoints.size()
208 << " oldPoints: " << oldPoints.size()
209 << " nPoints(): " << nPoints() << nl
210 << abort(FatalError);
213 // Create swept volumes
214 const faceList& f = faces();
216 tmp<scalarField> tsweptVols(new scalarField(f.size()));
217 scalarField& sweptVols = tsweptVols();
221 sweptVols[faceI] = f[faceI].sweptVol(oldPoints, newPoints);
224 // Force recalculation of all geometric data with new points
231 const Foam::cellShapeList& Foam::primitiveMesh::cellShapes() const
238 return *cellShapesPtr_;
242 // ************************************************************************* //