diff --git a/src/dynamicMesh/Make/files b/src/dynamicMesh/Make/files
index f769607f94..c9c748ec4a 100644
--- a/src/dynamicMesh/Make/files
+++ b/src/dynamicMesh/Make/files
@@ -84,7 +84,9 @@ polyMeshAdder/polyMeshAdder.C
fvMeshTools/fvMeshTools.C
motionSmoother/motionSmoother.C
-motionSmoother/motionSmootherCheck.C
+motionSmoother/motionSmootherAlgo.C
+motionSmoother/motionSmootherAlgoCheck.C
+motionSmoother/motionSmootherData.C
motionSmoother/polyMeshGeometry/polyMeshGeometry.C
motionSmoother/badQualityToCell/badQualityToCell.C
motionSmoother/badQualityToFace/badQualityToFace.C
diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.C b/src/dynamicMesh/motionSmoother/motionSmoother.C
new file mode 100644
index 0000000000..d30ee35732
--- /dev/null
+++ b/src/dynamicMesh/motionSmoother/motionSmoother.C
@@ -0,0 +1,86 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "motionSmoother.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ defineTypeNameAndDebug(motionSmoother, 0);
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::motionSmoother::motionSmoother
+(
+ polyMesh& mesh,
+ pointMesh& pMesh,
+ indirectPrimitivePatch& pp,
+ const labelList& adaptPatchIDs,
+ const dictionary& paramDict
+)
+:
+ motionSmootherData(pMesh),
+ motionSmootherAlgo
+ (
+ mesh,
+ pMesh,
+ pp,
+ motionSmootherData::displacement_,
+ motionSmootherData::scale_,
+ motionSmootherData::oldPoints_,
+ adaptPatchIDs,
+ paramDict
+ )
+{}
+
+
+Foam::motionSmoother::motionSmoother
+(
+ polyMesh& mesh,
+ indirectPrimitivePatch& pp,
+ const labelList& adaptPatchIDs,
+ const pointVectorField& displacement,
+ const dictionary& paramDict
+)
+:
+ motionSmootherData(displacement),
+ motionSmootherAlgo
+ (
+ mesh,
+ const_cast(displacement.mesh()),
+ pp,
+ motionSmootherData::displacement_,
+ motionSmootherData::scale_,
+ motionSmootherData::oldPoints_,
+ adaptPatchIDs,
+ paramDict
+ )
+{}
+
+
+// ************************************************************************* //
diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.H b/src/dynamicMesh/motionSmoother/motionSmoother.H
new file mode 100644
index 0000000000..3366f01d05
--- /dev/null
+++ b/src/dynamicMesh/motionSmoother/motionSmoother.H
@@ -0,0 +1,137 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::motionSmoother
+
+Description
+ Given a displacement moves the mesh by scaling the displacement back
+ until there are no more mesh errors.
+
+ Holds displacement field (read upon construction since need boundary
+ conditions) and scaling factor and optional patch number on which to
+ scale back displacement.
+
+ E.g.
+ \verbatim
+ // Construct iterative mesh mover.
+ motionSmoother meshMover(mesh, labelList(1, patchI));
+
+ // Set desired displacement:
+ meshMover.displacement() = ..
+
+ for (label iter = 0; iter < maxIter; iter++)
+ {
+ if (meshMover.scaleMesh(true))
+ {
+ Info<< "Successfully moved mesh" << endl;
+ return true;
+ }
+ }
+ \endverbatim
+
+Note
+ - Shared points (parallel): a processor can have points which are part of
+ pp on another processor but have no pp itself (i.e. it has points
+ and/or edges but no faces of pp). Hence we have to be careful when e.g.
+ synchronising displacements that the value from the processor which has
+ faces of pp get priority. This is currently handled in setDisplacement
+ by resetting the internal displacement to zero before doing anything
+ else. The combine operator used will give preference to non-zero
+ values.
+
+ - Various routines take baffles. These are sets of boundary faces that
+ are treated as a single internal face. This is a hack used to apply
+ movement to internal faces.
+
+ - Mesh constraints are looked up from the supplied dictionary. (uses
+ recursive lookup)
+
+SourceFiles
+ motionSmoother.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef motionSmoother_H
+#define motionSmoother_H
+
+#include "motionSmootherData.H"
+#include "motionSmootherAlgo.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class motionSmoother Declaration
+\*---------------------------------------------------------------------------*/
+
+class motionSmoother
+:
+ public motionSmootherData,
+ public motionSmootherAlgo
+
+{
+ // Private class
+
+public:
+
+ ClassName("motionSmoother");
+
+ // Constructors
+
+ //- Construct from mesh, patches to work on and smoothing parameters.
+ // Reads displacement field (only boundary conditions used)
+ motionSmoother
+ (
+ polyMesh&,
+ pointMesh&,
+ indirectPrimitivePatch& pp, // 'outside' points
+ const labelList& adaptPatchIDs, // patches forming 'outside'
+ const dictionary& paramDict
+ );
+
+ //- Construct from mesh, patches to work on and smoothing parameters and
+ // displacementfield (only boundary conditions used)
+ motionSmoother
+ (
+ polyMesh&,
+ indirectPrimitivePatch& pp, // 'outside' points
+ const labelList& adaptPatchIDs, // patches forming 'outside'
+ const pointVectorField&,
+ const dictionary& paramDict
+ );
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
index 1375099a4b..ad0fcac3fa 100644
--- a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
+++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
@@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
-#include "motionSmoother.H"
+#include "motionSmootherAlgo.H"
#include "twoDPointCorrector.H"
#include "faceSet.H"
#include "pointSet.H"
@@ -37,13 +37,13 @@ License
namespace Foam
{
- defineTypeNameAndDebug(motionSmoother, 0);
+ defineTypeNameAndDebug(motionSmootherAlgo, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
-void Foam::motionSmoother::testSyncPositions
+void Foam::motionSmootherAlgo::testSyncPositions
(
const pointField& fld,
const scalar maxMag
@@ -65,7 +65,7 @@ void Foam::motionSmoother::testSyncPositions
{
FatalErrorIn
(
- "motionSmoother::testSyncPositions"
+ "motionSmootherAlgo::testSyncPositions"
"("
"const pointField&, "
"const scalar"
@@ -78,7 +78,7 @@ void Foam::motionSmoother::testSyncPositions
}
-//Foam::tmp Foam::motionSmoother::sumWeights
+//Foam::tmp Foam::motionSmootherAlgo::sumWeights
//(
// const scalarField& edgeWeight
//) const
@@ -122,11 +122,11 @@ void Foam::motionSmoother::testSyncPositions
// From pointPatchInterpolation
-void Foam::motionSmoother::makePatchPatchAddressing()
+void Foam::motionSmootherAlgo::makePatchPatchAddressing()
{
if (debug)
{
- Pout<< "motionSmoother::makePatchPatchAddressing() : "
+ Pout<< "motionSmootherAlgo::makePatchPatchAddressing() : "
<< "constructing boundary addressing"
<< endl;
}
@@ -232,14 +232,14 @@ void Foam::motionSmoother::makePatchPatchAddressing()
meshTools::writeOBJ(str, mesh_.points()[pointI]);
}
- Pout<< "motionSmoother::makePatchPatchAddressing() : "
+ Pout<< "motionSmootherAlgo::makePatchPatchAddressing() : "
<< "finished constructing boundary addressing"
<< endl;
}
}
-void Foam::motionSmoother::checkFld(const pointScalarField& fld)
+void Foam::motionSmootherAlgo::checkFld(const pointScalarField& fld)
{
forAll(fld, pointI)
{
@@ -249,15 +249,18 @@ void Foam::motionSmoother::checkFld(const pointScalarField& fld)
{}
else
{
- FatalErrorIn("motionSmoother::checkFld(const pointScalarField&)")
- << "Problem : point:" << pointI << " value:" << val
+ FatalErrorIn
+ (
+ "motionSmootherAlgo::checkFld"
+ "(const pointScalarField&)"
+ ) << "Problem : point:" << pointI << " value:" << val
<< abort(FatalError);
}
}
}
-Foam::labelHashSet Foam::motionSmoother::getPoints
+Foam::labelHashSet Foam::motionSmootherAlgo::getPoints
(
const labelHashSet& faceLabels
) const
@@ -278,7 +281,7 @@ Foam::labelHashSet Foam::motionSmoother::getPoints
}
-Foam::tmp Foam::motionSmoother::calcEdgeWeights
+Foam::tmp Foam::motionSmootherAlgo::calcEdgeWeights
(
const pointField& points
) const
@@ -297,7 +300,7 @@ Foam::tmp Foam::motionSmoother::calcEdgeWeights
// Smooth on selected points (usually patch points)
-void Foam::motionSmoother::minSmooth
+void Foam::motionSmootherAlgo::minSmooth
(
const scalarField& edgeWeights,
const PackedBoolList& isAffectedPoint,
@@ -332,7 +335,7 @@ void Foam::motionSmoother::minSmooth
// Smooth on all internal points
-void Foam::motionSmoother::minSmooth
+void Foam::motionSmootherAlgo::minSmooth
(
const scalarField& edgeWeights,
const PackedBoolList& isAffectedPoint,
@@ -365,7 +368,7 @@ void Foam::motionSmoother::minSmooth
// Scale on all internal points
-void Foam::motionSmoother::scaleField
+void Foam::motionSmootherAlgo::scaleField
(
const labelHashSet& pointLabels,
const scalar scale,
@@ -385,7 +388,7 @@ void Foam::motionSmoother::scaleField
// Scale on selected points (usually patch points)
-void Foam::motionSmoother::scaleField
+void Foam::motionSmootherAlgo::scaleField
(
const labelList& meshPoints,
const labelHashSet& pointLabels,
@@ -406,7 +409,7 @@ void Foam::motionSmoother::scaleField
// Lower on internal points
-void Foam::motionSmoother::subtractField
+void Foam::motionSmootherAlgo::subtractField
(
const labelHashSet& pointLabels,
const scalar f,
@@ -426,7 +429,7 @@ void Foam::motionSmoother::subtractField
// Scale on selected points (usually patch points)
-void Foam::motionSmoother::subtractField
+void Foam::motionSmootherAlgo::subtractField
(
const labelList& meshPoints,
const labelHashSet& pointLabels,
@@ -446,13 +449,13 @@ void Foam::motionSmoother::subtractField
}
-bool Foam::motionSmoother::isInternalPoint(const label pointI) const
+bool Foam::motionSmootherAlgo::isInternalPoint(const label pointI) const
{
return isInternalPoint_.get(pointI) == 1;
}
-void Foam::motionSmoother::getAffectedFacesAndPoints
+void Foam::motionSmootherAlgo::getAffectedFacesAndPoints
(
const label nPointIter,
const faceSet& wrongFaces,
@@ -510,11 +513,14 @@ void Foam::motionSmoother::getAffectedFacesAndPoints
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-Foam::motionSmoother::motionSmoother
+Foam::motionSmootherAlgo::motionSmootherAlgo
(
polyMesh& mesh,
pointMesh& pMesh,
indirectPrimitivePatch& pp,
+ pointVectorField& displacement,
+ pointScalarField& scale,
+ pointField& oldPoints,
const labelList& adaptPatchIDs,
const dictionary& paramDict
)
@@ -522,81 +528,11 @@ Foam::motionSmoother::motionSmoother
mesh_(mesh),
pMesh_(pMesh),
pp_(pp),
+ displacement_(displacement),
+ scale_(scale),
+ oldPoints_(oldPoints),
adaptPatchIDs_(adaptPatchIDs),
paramDict_(paramDict),
- displacement_
- (
- IOobject
- (
- "displacement",
- mesh_.time().timeName(),
- mesh_,
- IOobject::MUST_READ,
- IOobject::AUTO_WRITE
- ),
- pMesh_
- ),
- scale_
- (
- IOobject
- (
- "scale",
- mesh_.time().timeName(),
- mesh_,
- IOobject::NO_READ,
- IOobject::AUTO_WRITE
- ),
- pMesh_,
- dimensionedScalar("scale", dimless, 1.0)
- ),
- oldPoints_(mesh_.points()),
- isInternalPoint_(mesh_.nPoints(), 1),
- twoDCorrector_(mesh_)
-{
- updateMesh();
-}
-
-
-Foam::motionSmoother::motionSmoother
-(
- polyMesh& mesh,
- indirectPrimitivePatch& pp,
- const labelList& adaptPatchIDs,
- const pointVectorField& displacement,
- const dictionary& paramDict
-)
-:
- mesh_(mesh),
- pMesh_(const_cast(displacement.mesh())),
- pp_(pp),
- adaptPatchIDs_(adaptPatchIDs),
- paramDict_(paramDict),
- displacement_
- (
- IOobject
- (
- "displacement",
- mesh_.time().timeName(),
- mesh_,
- IOobject::NO_READ,
- IOobject::AUTO_WRITE
- ),
- displacement
- ),
- scale_
- (
- IOobject
- (
- "scale",
- mesh_.time().timeName(),
- mesh_,
- IOobject::NO_READ,
- IOobject::AUTO_WRITE
- ),
- pMesh_,
- dimensionedScalar("scale", dimless, 1.0)
- ),
- oldPoints_(mesh_.points()),
isInternalPoint_(mesh_.nPoints(), 1),
twoDCorrector_(mesh_)
{
@@ -606,67 +542,43 @@ Foam::motionSmoother::motionSmoother
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-Foam::motionSmoother::~motionSmoother()
+Foam::motionSmootherAlgo::~motionSmootherAlgo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-const Foam::polyMesh& Foam::motionSmoother::mesh() const
+const Foam::polyMesh& Foam::motionSmootherAlgo::mesh() const
{
return mesh_;
}
-const Foam::pointMesh& Foam::motionSmoother::pMesh() const
+const Foam::pointMesh& Foam::motionSmootherAlgo::pMesh() const
{
return pMesh_;
}
-const Foam::indirectPrimitivePatch& Foam::motionSmoother::patch() const
+const Foam::indirectPrimitivePatch& Foam::motionSmootherAlgo::patch() const
{
return pp_;
}
-const Foam::labelList& Foam::motionSmoother::adaptPatchIDs() const
+const Foam::labelList& Foam::motionSmootherAlgo::adaptPatchIDs() const
{
return adaptPatchIDs_;
}
-const Foam::dictionary& Foam::motionSmoother::paramDict() const
+const Foam::dictionary& Foam::motionSmootherAlgo::paramDict() const
{
return paramDict_;
}
-Foam::pointVectorField& Foam::motionSmoother::displacement()
-{
- return displacement_;
-}
-
-
-const Foam::pointVectorField& Foam::motionSmoother::displacement() const
-{
- return displacement_;
-}
-
-
-const Foam::pointScalarField& Foam::motionSmoother::scale() const
-{
- return scale_;
-}
-
-
-const Foam::pointField& Foam::motionSmoother::oldPoints() const
-{
- return oldPoints_;
-}
-
-
-void Foam::motionSmoother::correct()
+void Foam::motionSmootherAlgo::correct()
{
oldPoints_ = mesh_.points();
@@ -674,11 +586,11 @@ void Foam::motionSmoother::correct()
// No need to update twoDmotion corrector since only holds edge labels
// which will remain the same as before. So unless the mesh was distorted
- // severely outside of motionSmoother there will be no need.
+ // severely outside of motionSmootherAlgo there will be no need.
}
-void Foam::motionSmoother::setDisplacementPatchFields()
+void Foam::motionSmootherAlgo::setDisplacementPatchFields()
{
// Adapt the fixedValue bc's (i.e. copy internal point data to
// boundaryField for all affected patches)
@@ -742,7 +654,7 @@ void Foam::motionSmoother::setDisplacementPatchFields()
}
-void Foam::motionSmoother::setDisplacement(pointField& patchDisp)
+void Foam::motionSmootherAlgo::setDisplacement(pointField& patchDisp)
{
// See comment in .H file about shared points.
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
@@ -808,7 +720,7 @@ void Foam::motionSmoother::setDisplacement(pointField& patchDisp)
// correctBoundaryConditions with fixedValue bc's first.
-void Foam::motionSmoother::correctBoundaryConditions
+void Foam::motionSmootherAlgo::correctBoundaryConditions
(
pointVectorField& displacement
) const
@@ -873,7 +785,7 @@ void Foam::motionSmoother::correctBoundaryConditions
-void Foam::motionSmoother::modifyMotionPoints(pointField& newPoints) const
+void Foam::motionSmootherAlgo::modifyMotionPoints(pointField& newPoints) const
{
// Correct for 2-D motion
if (twoDCorrector_.required())
@@ -882,7 +794,7 @@ void Foam::motionSmoother::modifyMotionPoints(pointField& newPoints) const
if (mesh_.globalData().parallel())
{
- WarningIn("motionSmoother::movePoints(pointField&)")
+ WarningIn("motionSmootherAlgo::movePoints(pointField&)")
<< "2D mesh-motion probably not correct in parallel" << endl;
}
@@ -913,14 +825,15 @@ void Foam::motionSmoother::modifyMotionPoints(pointField& newPoints) const
if (debug)
{
- Pout<< "motionSmoother::modifyMotionPoints : testing sync of newPoints."
+ Pout<< "motionSmootherAlgo::modifyMotionPoints :"
+ << " testing sync of newPoints."
<< endl;
testSyncPositions(newPoints, 1e-6*mesh_.bounds().mag());
}
}
-void Foam::motionSmoother::movePoints()
+void Foam::motionSmootherAlgo::movePoints()
{
// Make sure to clear out tetPtIs since used in checks (sometimes, should
// really check)
@@ -929,7 +842,7 @@ void Foam::motionSmoother::movePoints()
}
-Foam::scalar Foam::motionSmoother::setErrorReduction
+Foam::scalar Foam::motionSmootherAlgo::setErrorReduction
(
const scalar errorReduction
)
@@ -943,7 +856,7 @@ Foam::scalar Foam::motionSmoother::setErrorReduction
}
-bool Foam::motionSmoother::scaleMesh
+bool Foam::motionSmootherAlgo::scaleMesh
(
labelList& checkFaces,
const bool smoothMesh,
@@ -961,7 +874,7 @@ bool Foam::motionSmoother::scaleMesh
}
-bool Foam::motionSmoother::scaleMesh
+bool Foam::motionSmootherAlgo::scaleMesh
(
labelList& checkFaces,
const List& baffles,
@@ -981,7 +894,7 @@ bool Foam::motionSmoother::scaleMesh
}
-Foam::tmp Foam::motionSmoother::curPoints() const
+Foam::tmp Foam::motionSmootherAlgo::curPoints() const
{
// Set newPoints as old + scale*displacement
@@ -1054,7 +967,7 @@ Foam::tmp Foam::motionSmoother::curPoints() const
}
-bool Foam::motionSmoother::scaleMesh
+bool Foam::motionSmootherAlgo::scaleMesh
(
labelList& checkFaces,
const List& baffles,
@@ -1068,7 +981,7 @@ bool Foam::motionSmoother::scaleMesh
{
FatalErrorIn
(
- "motionSmoother::scaleMesh"
+ "motionSmootherAlgo::scaleMesh"
"("
"labelList&, "
"const List&, "
@@ -1271,7 +1184,7 @@ bool Foam::motionSmoother::scaleMesh
}
-void Foam::motionSmoother::updateMesh()
+void Foam::motionSmootherAlgo::updateMesh()
{
const pointBoundaryMesh& patches = pMesh_.boundary();
@@ -1290,7 +1203,7 @@ void Foam::motionSmoother::updateMesh()
{
FatalErrorIn
(
- "motionSmoother::updateMesh"
+ "motionSmootherAlgo::updateMesh"
) << "Patch " << patches[patchI].name()
<< " has wrong boundary condition "
<< displacement_.boundaryField()[patchI].type()
@@ -1324,7 +1237,7 @@ void Foam::motionSmoother::updateMesh()
// Specialisation of applyCornerConstraints for scalars because
// no constraint need be applied
template<>
-void Foam::motionSmoother::applyCornerConstraints
+void Foam::motionSmootherAlgo::applyCornerConstraints
(
GeometricField& pf
) const
diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.H b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.H
index 33bb2835e2..7cffaf6606 100644
--- a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.H
+++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.H
@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see .
Class
- Foam::motionSmoother
+ Foam::motionSmootherAlgo
Description
Given a displacement moves the mesh by scaling the displacement back
@@ -68,13 +68,13 @@ Note
recursive lookup)
SourceFiles
- motionSmoother.C
- motionSmootherTemplates.C
+ motionSmootherAlgo.C
+ motionSmootherAlgoTemplates.C
\*---------------------------------------------------------------------------*/
-#ifndef motionSmoother_H
-#define motionSmoother_H
+#ifndef motionSmootherAlgo_H
+#define motionSmootherAlgo_H
#include "pointFields.H"
#include "HashSet.H"
@@ -92,10 +92,10 @@ class polyMeshGeometry;
class faceSet;
/*---------------------------------------------------------------------------*\
- Class motionSmoother Declaration
+ Class motionSmootherAlgo Declaration
\*---------------------------------------------------------------------------*/
-class motionSmoother
+class motionSmootherAlgo
{
// Private class
@@ -141,39 +141,39 @@ class motionSmoother
//- Reference to face subset of all adaptPatchIDs
indirectPrimitivePatch& pp_;
- //- Indices of fixedValue patches that we're allowed to modify the
- // displacement on.
- const labelList adaptPatchIDs_;
+ //- Displacement field
+ pointVectorField& displacement_;
+ //- Scale factor for displacement
+ pointScalarField& scale_;
+
+ //- Starting mesh position
+ pointField& oldPoints_;
- // Smoothing and checking parameters
- dictionary paramDict_;
// Internal data
- //- Displacement field
- pointVectorField displacement_;
+ //- Indices of fixedValue patches that we're allowed to modify the
+ // displacement on.
+ const labelList adaptPatchIDs_;
- //- Scale factor for displacement
- pointScalarField scale_;
+ // Smoothing and checking parameters
+ dictionary paramDict_;
- //- Starting mesh position
- pointField oldPoints_;
+ //- Is mesh point on boundary or not
+ PackedBoolList isInternalPoint_;
- //- Is mesh point on boundary or not
- PackedBoolList isInternalPoint_;
+ //- Is edge master (always except if on coupled boundary and on
+ // lower processor)
+ PackedBoolList isMasterEdge_;
- //- Is edge master (always except if on coupled boundary and on
- // lower processor)
- PackedBoolList isMasterEdge_;
+ //- 2-D motion corrector
+ twoDPointCorrector twoDCorrector_;
- //- 2-D motion corrector
- twoDPointCorrector twoDCorrector_;
+ // Muli-patch constraints (from pointPatchInterpolation)
- // Muli-patch constraints (from pointPatchInterpolation)
-
- labelList patchPatchPointConstraintPoints_;
- tensorField patchPatchPointConstraintTensors_;
+ labelList patchPatchPointConstraintPoints_;
+ tensorField patchPatchPointConstraintTensors_;
// Private Member Functions
@@ -303,43 +303,34 @@ class motionSmoother
) const;
//- Disallow default bitwise copy construct
- motionSmoother(const motionSmoother&);
+ motionSmootherAlgo(const motionSmootherAlgo&);
//- Disallow default bitwise assignment
- void operator=(const motionSmoother&);
+ void operator=(const motionSmootherAlgo&);
public:
- ClassName("motionSmoother");
+ ClassName("motionSmootherAlgo");
// Constructors
//- Construct from mesh, patches to work on and smoothing parameters.
- // Reads displacement field (only boundary conditions used)
- motionSmoother
+ motionSmootherAlgo
(
polyMesh&,
pointMesh&,
indirectPrimitivePatch& pp, // 'outside' points
+ pointVectorField& displacement,
+ pointScalarField& scale,
+ pointField& oldPoints,
const labelList& adaptPatchIDs, // patches forming 'outside'
const dictionary& paramDict
);
- //- Construct from mesh, patches to work on and smoothing parameters and
- // displacementfield (only boundary conditions used)
- motionSmoother
- (
- polyMesh&,
- indirectPrimitivePatch& pp, // 'outside' points
- const labelList& adaptPatchIDs, // patches forming 'outside'
- const pointVectorField&,
- const dictionary& paramDict
- );
-
//- Destructor
- ~motionSmoother();
+ ~motionSmootherAlgo();
// Member Functions
@@ -360,18 +351,6 @@ public:
const dictionary& paramDict() const;
- //- Reference to displacement field
- pointVectorField& displacement();
-
- //- Reference to displacement field
- const pointVectorField& displacement() const;
-
- //- Reference to scale field
- const pointScalarField& scale() const;
-
- //- Starting mesh position
- const pointField& oldPoints() const;
-
//- Return reference to 2D point motion correction
twoDPointCorrector& twoDCorrector()
{
@@ -532,7 +511,7 @@ public:
template<>
-void motionSmoother::applyCornerConstraints
+void motionSmootherAlgo::applyCornerConstraints
(
GeometricField& pf
) const;
@@ -545,7 +524,7 @@ void motionSmoother::applyCornerConstraints
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
-# include "motionSmootherTemplates.C"
+# include "motionSmootherAlgoTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C
index 3efb62a995..07859539a5 100644
--- a/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C
+++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgoCheck.C
@@ -23,13 +23,13 @@ License
\*---------------------------------------------------------------------------*/
-#include "motionSmoother.H"
+#include "motionSmootherAlgo.H"
#include "polyMeshGeometry.H"
#include "IOmanip.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-bool Foam::motionSmoother::checkMesh
+bool Foam::motionSmootherAlgo::checkMesh
(
const bool report,
const polyMesh& mesh,
@@ -50,7 +50,7 @@ bool Foam::motionSmoother::checkMesh
);
}
-bool Foam::motionSmoother::checkMesh
+bool Foam::motionSmootherAlgo::checkMesh
(
const bool report,
const polyMesh& mesh,
@@ -411,7 +411,7 @@ bool Foam::motionSmoother::checkMesh
}
-bool Foam::motionSmoother::checkMesh
+bool Foam::motionSmootherAlgo::checkMesh
(
const bool report,
const polyMesh& mesh,
@@ -429,7 +429,7 @@ bool Foam::motionSmoother::checkMesh
);
}
-bool Foam::motionSmoother::checkMesh
+bool Foam::motionSmootherAlgo::checkMesh
(
const bool report,
const dictionary& dict,
@@ -452,7 +452,7 @@ bool Foam::motionSmoother::checkMesh
}
-bool Foam::motionSmoother::checkMesh
+bool Foam::motionSmootherAlgo::checkMesh
(
const bool report,
const dictionary& dict,
diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgoTemplates.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgoTemplates.C
index 89667aade3..0e9770750a 100644
--- a/src/dynamicMesh/motionSmoother/motionSmootherAlgoTemplates.C
+++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgoTemplates.C
@@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
-#include "motionSmoother.H"
+#include "motionSmootherAlgo.H"
#include "meshTools.H"
#include "processorPointPatchFields.H"
#include "pointConstraint.H"
@@ -32,7 +32,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template
-void Foam::motionSmoother::checkConstraints
+void Foam::motionSmootherAlgo::checkConstraints
(
GeometricField& pf
)
@@ -119,7 +119,7 @@ void Foam::motionSmoother::checkConstraints
{
FatalErrorIn
(
- "motionSmoother::checkConstraints"
+ "motionSmootherAlgo::checkConstraints"
"(GeometricField&)"
) << "Patch fields are not consistent on mesh point "
<< ppp << " coordinate " << mesh.points()[ppp]
@@ -136,7 +136,7 @@ void Foam::motionSmoother::checkConstraints
template
-void Foam::motionSmoother::applyCornerConstraints
+void Foam::motionSmootherAlgo::applyCornerConstraints
(
GeometricField& pf
) const
@@ -155,7 +155,7 @@ void Foam::motionSmoother::applyCornerConstraints
// Average of connected points.
template
Foam::tmp >
-Foam::motionSmoother::avg
+Foam::motionSmootherAlgo::avg
(
const GeometricField& fld,
const scalarField& edgeWeight
@@ -253,7 +253,7 @@ Foam::motionSmoother::avg
// smooth field (point-jacobi)
template
-void Foam::motionSmoother::smooth
+void Foam::motionSmootherAlgo::smooth
(
const GeometricField& fld,
const scalarField& edgeWeight,
@@ -278,7 +278,7 @@ void Foam::motionSmoother::smooth
//- Test synchronisation of generic field (not positions!) on points
template
-void Foam::motionSmoother::testSyncField
+void Foam::motionSmootherAlgo::testSyncField
(
const Field& fld,
const CombineOp& cop,
@@ -308,7 +308,7 @@ void Foam::motionSmoother::testSyncField
{
FatalErrorIn
(
- "motionSmoother::testSyncField"
+ "motionSmootherAlgo::testSyncField"
"(const Field&, const CombineOp&"
", const Type&, const bool)"
) << "On element " << i << " value:" << fld[i]
diff --git a/src/dynamicMesh/motionSmoother/motionSmootherData.C b/src/dynamicMesh/motionSmoother/motionSmootherData.C
new file mode 100644
index 0000000000..6fa5d8c095
--- /dev/null
+++ b/src/dynamicMesh/motionSmoother/motionSmootherData.C
@@ -0,0 +1,124 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "motionSmootherData.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::motionSmootherData::motionSmootherData
+(
+ const pointMesh& pMesh
+)
+:
+ displacement_
+ (
+ IOobject
+ (
+ "displacement",
+ pMesh.time().timeName(),
+ pMesh(),
+ IOobject::MUST_READ,
+ IOobject::AUTO_WRITE
+ ),
+ pMesh
+ ),
+ scale_
+ (
+ IOobject
+ (
+ "scale",
+ pMesh.time().timeName(),
+ pMesh(),
+ IOobject::NO_READ,
+ IOobject::AUTO_WRITE
+ ),
+ pMesh,
+ dimensionedScalar("scale", dimless, 1.0)
+ ),
+ oldPoints_(pMesh().points())
+{}
+
+
+Foam::motionSmootherData::motionSmootherData
+(
+ const pointVectorField& displacement
+)
+:
+ displacement_
+ (
+ IOobject
+ (
+ "displacement",
+ displacement.time().timeName(),
+ displacement.mesh()(),
+ IOobject::NO_READ,
+ IOobject::AUTO_WRITE
+ ),
+ displacement
+ ),
+ scale_
+ (
+ IOobject
+ (
+ "scale",
+ displacement.time().timeName(),
+ displacement.mesh()(),
+ IOobject::NO_READ,
+ IOobject::AUTO_WRITE
+ ),
+ displacement.mesh(),
+ dimensionedScalar("scale", dimless, 1.0)
+ ),
+ oldPoints_(displacement.mesh()().points())
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+Foam::pointVectorField& Foam::motionSmootherData::displacement()
+{
+ return displacement_;
+}
+
+
+const Foam::pointVectorField& Foam::motionSmootherData::displacement() const
+{
+ return displacement_;
+}
+
+
+const Foam::pointScalarField& Foam::motionSmootherData::scale() const
+{
+ return scale_;
+}
+
+
+const Foam::pointField& Foam::motionSmootherData::oldPoints() const
+{
+ return oldPoints_;
+}
+
+
+// ************************************************************************* //
diff --git a/src/dynamicMesh/motionSmoother/motionSmootherData.H b/src/dynamicMesh/motionSmoother/motionSmootherData.H
new file mode 100644
index 0000000000..a4f2fa8a59
--- /dev/null
+++ b/src/dynamicMesh/motionSmoother/motionSmootherData.H
@@ -0,0 +1,106 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::motionSmootherData
+
+Description
+
+SourceFiles
+ motionSmootherData.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef motionSmootherData_H
+#define motionSmootherData_H
+
+#include "pointFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class motionSmootherData Declaration
+\*---------------------------------------------------------------------------*/
+
+class motionSmootherData
+{
+protected:
+
+ // Private data
+
+ //- Displacement field
+ pointVectorField displacement_;
+
+ //- Scale factor for displacement
+ pointScalarField scale_;
+
+ //- Starting mesh position
+ pointField oldPoints_;
+
+
+public:
+
+ // Constructors
+
+ //- Construct read
+ motionSmootherData
+ (
+ const pointMesh&
+ );
+
+ //- Construct from pointDisplacement
+ motionSmootherData
+ (
+ const pointVectorField&
+ );
+
+
+ // Member Functions
+
+ //- Reference to displacement field
+ pointVectorField& displacement();
+
+ //- Reference to displacement field
+ const pointVectorField& displacement() const;
+
+ //- Reference to scale field
+ const pointScalarField& scale() const;
+
+ //- Starting mesh position
+ const pointField& oldPoints() const;
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //