1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "primitiveMesh.H"
27 #include "demandDrivenData.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 defineTypeNameAndDebug(Foam::primitiveMesh, 0);
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 Foam::primitiveMesh::primitiveMesh()
62 cellCentresPtr_(NULL),
63 faceCentresPtr_(NULL),
64 cellVolumesPtr_(NULL),
69 // Construct from components
70 // WARNING: ASSUMES CORRECT ORDERING OF DATA.
71 Foam::primitiveMesh::primitiveMesh
74 const label nInternalFaces,
81 nInternalFaces_(nInternalFaces),
103 cellCentresPtr_(NULL),
104 faceCentresPtr_(NULL),
105 cellVolumesPtr_(NULL),
110 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
112 Foam::primitiveMesh::~primitiveMesh()
118 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
120 void Foam::primitiveMesh::reset
123 const label nInternalFaces,
133 nInternalFaces_ = nInternalFaces;
139 Pout<< "primitiveMesh::reset : mesh reset to"
140 << " nPoints:" << nPoints_
141 << " nEdges:" << nEdges_
142 << " nInternalFaces:" << nInternalFaces_
143 << " nFaces:" << nFaces_
144 << " nCells:" << nCells_
150 void Foam::primitiveMesh::reset
153 const label nInternalFaces,
167 cfPtr_ = new cellList(clst, true);
171 void Foam::primitiveMesh::reset
174 const label nInternalFaces,
177 const Xfer<cellList>& clst
188 cfPtr_ = new cellList(clst);
192 Foam::tmp<Foam::scalarField> Foam::primitiveMesh::movePoints
194 const pointField& newPoints,
195 const pointField& oldPoints
198 if (newPoints.size() < nPoints() || oldPoints.size() < nPoints())
202 "primitiveMesh::movePoints(const pointField& newPoints, "
203 "const pointField& oldPoints)"
204 ) << "Cannot move points: size of given point list smaller "
205 << "than the number of active points" << nl
206 << "newPoints: " << newPoints.size()
207 << " oldPoints: " << oldPoints.size()
208 << " nPoints(): " << nPoints() << nl
209 << abort(FatalError);
212 // Create swept volumes
213 const faceList& f = faces();
215 tmp<scalarField> tsweptVols(new scalarField(f.size()));
216 scalarField& sweptVols = tsweptVols();
220 sweptVols[faceI] = f[faceI].sweptVol(oldPoints, newPoints);
223 // Force recalculation of all geometric data with new points
230 const Foam::cellShapeList& Foam::primitiveMesh::cellShapes() const
237 return *cellShapesPtr_;
241 // ************************************************************************* //