ENH: pointMesh: use MeshObject form

This commit is contained in:
mattijs
2012-08-31 12:57:17 +01:00
parent 603b05c563
commit c1ef233e5d
9 changed files with 44 additions and 62 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
# include "createMesh.H" # include "createMesh.H"
pointMesh pMesh(mesh); const pointMesh& pMesh = pointMesh::New(mesh);
pointVectorField U pointVectorField U
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -60,8 +60,6 @@ int main(int argc, char *argv[])
# include "createMesh.H" # include "createMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
pointMesh pMesh(mesh);
word cellSetName(args.args()[1]); word cellSetName(args.args()[1]);
const bool overwrite = args.optionFound("overwrite"); const bool overwrite = args.optionFound("overwrite");
@ -114,11 +112,10 @@ int main(int argc, char *argv[])
// Read point fields // Read point fields
PtrList<pointScalarField> psFlds; PtrList<pointScalarField> psFlds;
ReadFields(pMesh, objects, psFlds); ReadFields(pointMesh::New(mesh), objects, psFlds);
PtrList<pointVectorField> pvFlds; PtrList<pointVectorField> pvFlds;
ReadFields(pMesh, objects, pvFlds); ReadFields(pointMesh::New(mesh), objects, pvFlds);
// Construct refiner without unrefinement. Read existing point/cell level. // Construct refiner without unrefinement. Read existing point/cell level.
@ -164,7 +161,6 @@ int main(int argc, char *argv[])
// Update fields // Update fields
mesh.updateMesh(map); mesh.updateMesh(map);
pMesh.updateMesh(map);
// Update numbering of cells/vertices. // Update numbering of cells/vertices.
meshCutter.updateMesh(map); meshCutter.updateMesh(map);
@ -173,7 +169,6 @@ int main(int argc, char *argv[])
if (map().hasMotionPoints()) if (map().hasMotionPoints())
{ {
mesh.movePoints(map().preMotionPoints()); mesh.movePoints(map().preMotionPoints());
pMesh.movePoints(map().preMotionPoints());
} }
Pout<< "Refined from " << returnReduce(map().nOldCells(), sumOp<label>()) Pout<< "Refined from " << returnReduce(map().nOldCells(), sumOp<label>())

View File

@ -395,7 +395,7 @@ int main(int argc, char *argv[])
// Construct the point fields // Construct the point fields
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~
pointMesh pMesh(mesh); const pointMesh& pMesh = pointMesh::New(mesh);
PtrList<pointScalarField> pointScalarFields; PtrList<pointScalarField> pointScalarFields;
readFields(pMesh, objects, pointScalarFields); readFields(pMesh, objects, pointScalarFields);

View File

@ -341,7 +341,7 @@ int main(int argc, char *argv[])
{ {
Info<< "Reconstructing point fields" << nl << endl; Info<< "Reconstructing point fields" << nl << endl;
pointMesh pMesh(mesh); const pointMesh& pMesh = pointMesh::New(mesh);
PtrList<pointMesh> pMeshes(procMeshes.meshes().size()); PtrList<pointMesh> pMeshes(procMeshes.meshes().size());
forAll(pMeshes, procI) forAll(pMeshes, procI)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -195,7 +195,7 @@ void Foam::vtkPV3Foam::convertPointFields
} }
// Construct interpolation on the raw mesh // Construct interpolation on the raw mesh
pointMesh pMesh(mesh); const pointMesh& pMesh = pointMesh::New(mesh);
convertPointFields<scalar> convertPointFields<scalar>

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1133,7 +1133,7 @@ void user_read_one_grid_function
// Set fieldvalues // Set fieldvalues
// //
pointMesh pMesh(mesh); const pointMesh& pMesh = pointMesh::New(mesh);
volPointInterpolation pInterp(mesh, pMesh); volPointInterpolation pInterp(mesh, pMesh);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
# include "createNamedMesh.H" # include "createNamedMesh.H"
pointMesh pMesh(mesh); const pointMesh& pMesh = pointMesh::New(mesh);
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
{ {

View File

@ -42,7 +42,7 @@ namespace Foam
addToRunTimeSelectionTable addToRunTimeSelectionTable
( (
fvMotionSolver, motionSolver,
displacementSBRStressFvMotionSolver, displacementSBRStressFvMotionSolver,
dictionary dictionary
); );
@ -54,22 +54,11 @@ namespace Foam
Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
( (
const polyMesh& mesh, const polyMesh& mesh,
Istream& is const IOdictionary& dict
) )
: :
displacementFvMotionSolver(mesh, is), displacementMotionSolver(mesh, dict, typeName),
pointDisplacement_ fvMotionSolverCore(mesh),
(
IOobject
(
"pointDisplacement",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(fvMesh_)
),
cellDisplacement_ cellDisplacement_
( (
IOobject IOobject
@ -84,14 +73,14 @@ Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
dimensionedVector dimensionedVector
( (
"cellDisplacement", "cellDisplacement",
pointDisplacement_.dimensions(), pointDisplacement().dimensions(),
vector::zero vector::zero
), ),
cellMotionBoundaryTypes<vector>(pointDisplacement_.boundaryField()) cellMotionBoundaryTypes<vector>(pointDisplacement().boundaryField())
), ),
diffusivityPtr_ diffusivityPtr_
( (
motionDiffusivity::New(fvMesh_, lookup("diffusivity")) motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
) )
{} {}
@ -116,7 +105,7 @@ Foam::displacementSBRStressFvMotionSolver::curPoints() const
tmp<pointField> tcurPoints tmp<pointField> tcurPoints
( (
points0() + pointDisplacement_.internalField() points0() + pointDisplacement().internalField()
); );
twoDCorrectPoints(tcurPoints()); twoDCorrectPoints(tcurPoints());
@ -128,7 +117,7 @@ Foam::displacementSBRStressFvMotionSolver::curPoints() const
void Foam::displacementSBRStressFvMotionSolver::solve() void Foam::displacementSBRStressFvMotionSolver::solve()
{ {
// The points have moved so before interpolation update // The points have moved so before interpolation update
// the motionSolver accordingly // the mtionSolver accordingly
movePoints(fvMesh_.points()); movePoints(fvMesh_.points());
diffusivityPtr_->correct(); diffusivityPtr_->correct();
@ -192,12 +181,16 @@ void Foam::displacementSBRStressFvMotionSolver::updateMesh
const mapPolyMesh& mpm const mapPolyMesh& mpm
) )
{ {
displacementFvMotionSolver::updateMesh(mpm); displacementMotionSolver::updateMesh(mpm);
// Update diffusivity. Note two stage to make sure old one is de-registered // Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one. // before creating/registering new one.
diffusivityPtr_.reset(NULL); diffusivityPtr_.reset(NULL);
diffusivityPtr_ = motionDiffusivity::New(fvMesh_, lookup("diffusivity")); diffusivityPtr_ = motionDiffusivity::New
(
fvMesh_,
coeffDict().lookup("diffusivity")
);
} }

View File

@ -40,7 +40,7 @@ namespace Foam
addToRunTimeSelectionTable addToRunTimeSelectionTable
( (
fvMotionSolver, motionSolver,
displacementLaplacianFvMotionSolver, displacementLaplacianFvMotionSolver,
dictionary dictionary
); );
@ -52,22 +52,11 @@ namespace Foam
Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
( (
const polyMesh& mesh, const polyMesh& mesh,
Istream& is const IOdictionary& dict
) )
: :
displacementFvMotionSolver(mesh, is), displacementMotionSolver(mesh, dict, typeName),
pointDisplacement_ fvMotionSolverCore(mesh),
(
IOobject
(
"pointDisplacement",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh::New(fvMesh_)
),
cellDisplacement_ cellDisplacement_
( (
IOobject IOobject
@ -90,12 +79,12 @@ Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
pointLocation_(NULL), pointLocation_(NULL),
diffusivityPtr_ diffusivityPtr_
( (
motionDiffusivity::New(fvMesh_, lookup("diffusivity")) motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
), ),
frozenPointsZone_ frozenPointsZone_
( (
found("frozenPointsZone") coeffDict().found("frozenPointsZone")
? fvMesh_.pointZones().findZoneID(lookup("frozenPointsZone")) ? fvMesh_.pointZones().findZoneID(coeffDict().lookup("frozenPointsZone"))
: -1 : -1
) )
{ {
@ -131,7 +120,8 @@ Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
{ {
Info<< "displacementLaplacianFvMotionSolver :" Info<< "displacementLaplacianFvMotionSolver :"
<< " Read pointVectorField " << " Read pointVectorField "
<< io.name() << " to be used for boundary conditions on points." << io.name()
<< " to be used for boundary conditions on points."
<< nl << nl
<< "Boundary conditions:" << "Boundary conditions:"
<< pointLocation_().boundaryField().types() << endl; << pointLocation_().boundaryField().types() << endl;
@ -217,7 +207,7 @@ Foam::displacementLaplacianFvMotionSolver::curPoints() const
void Foam::displacementLaplacianFvMotionSolver::solve() void Foam::displacementLaplacianFvMotionSolver::solve()
{ {
// The points have moved so before interpolation update // The points have moved so before interpolation update
// the fvMotionSolver accordingly // the motionSolver accordingly
movePoints(fvMesh_.points()); movePoints(fvMesh_.points());
diffusivityPtr_->correct(); diffusivityPtr_->correct();
@ -240,12 +230,16 @@ void Foam::displacementLaplacianFvMotionSolver::updateMesh
const mapPolyMesh& mpm const mapPolyMesh& mpm
) )
{ {
displacementFvMotionSolver::updateMesh(mpm); displacementMotionSolver::updateMesh(mpm);
// Update diffusivity. Note two stage to make sure old one is de-registered // Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one. // before creating/registering new one.
diffusivityPtr_.reset(NULL); diffusivityPtr_.reset(NULL);
diffusivityPtr_ = motionDiffusivity::New(fvMesh_, lookup("diffusivity")); diffusivityPtr_ = motionDiffusivity::New
(
fvMesh_,
coeffDict().lookup("diffusivity")
);
} }