1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh 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 cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "edgeMeshGeometryModification.H"
27 #include "demandDrivenData.H"
28 #include "dictionary.H"
34 // * * * * * * * * * * * * * * Private member functions* * * * * * * * * * * //
36 void edgeMeshGeometryModification::checkModification()
38 if( meshDict_.found("anisotropicSources") )
40 modificationActive_ = true;
42 const dictionary& anisotropicDict =
43 meshDict_.subDict("anisotropicSources");
45 coordinateModifierPtr_ = new coordinateModifier(anisotropicDict);
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 edgeMeshGeometryModification::edgeMeshGeometryModification
54 const dictionary& meshDict
59 coordinateModifierPtr_(NULL),
60 modificationActive_(false)
65 edgeMeshGeometryModification::~edgeMeshGeometryModification()
67 deleteDemandDrivenData(coordinateModifierPtr_);
70 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 bool edgeMeshGeometryModification::activeModification() const
74 return modificationActive_;
77 const edgeMesh* edgeMeshGeometryModification::modifyGeometry() const
79 if( !modificationActive_ )
83 "const edgeMesh* edgeMeshGeometryModification"
84 "::modifyGeometry() const"
85 ) << "Modification is not active" << endl;
90 const pointField& pts = edgeMesh_.points();
92 pointField newPts(pts.size());
95 # pragma omp parallel for schedule(dynamic, 50)
98 newPts[pointI] = coordinateModifierPtr_->modifiedPoint(pts[pointI]);
100 const edgeMesh* newEdgeMesh = new edgeMesh(newPts, edgeMesh_.edges());
105 const edgeMesh* edgeMeshGeometryModification::
106 revertGeometryModification() const
108 if( !modificationActive_ )
112 "const edgeMesh* edgeMeshGeometryModification"
113 "::revertGeometryModification() const"
114 ) << "Modification is not active" << endl;
119 const pointField& pts = edgeMesh_.points();
121 pointField newPts(pts.size());
124 # pragma omp parallel for schedule(dynamic, 50)
129 coordinateModifierPtr_->backwardModifiedPoint(pts[pointI]);
132 const edgeMesh* newEdgeMeshPtr = new edgeMesh(newPts, edgeMesh_.edges());
134 return newEdgeMeshPtr;
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 } // End namespace Foam
141 // ************************************************************************* //