ENH: pointConstraints: make polyMesh meshObject (since pointMeshes not currently updated!)

This commit is contained in:
mattijs
2013-12-04 15:55:39 +00:00
parent a5ebecbd3a
commit bab168b5af
7 changed files with 42 additions and 24 deletions

View File

@ -169,7 +169,7 @@ void Foam::motionSmootherAlgo::minSmooth
} }
// Single and multi-patch constraints // Single and multi-patch constraints
pointConstraints::New(newFld.mesh()).constrain(newFld, false); pointConstraints::New(mesh()).constrain(newFld, false);
} }
@ -202,7 +202,7 @@ void Foam::motionSmootherAlgo::minSmooth
} }
// Single and multi-patch constraints // Single and multi-patch constraints
pointConstraints::New(newFld.mesh()).constrain(newFld, false); pointConstraints::New(mesh()).constrain(newFld, false);
} }
@ -224,7 +224,7 @@ void Foam::motionSmootherAlgo::scaleField
} }
// Single and multi-patch constraints // Single and multi-patch constraints
pointConstraints::New(fld.mesh()).constrain(fld, false); pointConstraints::New(mesh()).constrain(fld, false);
} }
@ -266,7 +266,7 @@ void Foam::motionSmootherAlgo::subtractField
} }
// Single and multi-patch constraints // Single and multi-patch constraints
pointConstraints::New(fld.mesh()).constrain(fld); pointConstraints::New(mesh()).constrain(fld);
} }
@ -476,7 +476,7 @@ void Foam::motionSmootherAlgo::setDisplacementPatchFields
} }
// Multi-patch constraints // Multi-patch constraints
pointConstraints::New(displacement.mesh()).constrainCorners(displacement); pointConstraints::New(displacement.mesh()()).constrainCorners(displacement);
// Adapt the fixedValue bc's (i.e. copy internal point data to // Adapt the fixedValue bc's (i.e. copy internal point data to
// boundaryField for all affected patches) to take the changes caused // boundaryField for all affected patches) to take the changes caused
@ -622,7 +622,7 @@ void Foam::motionSmootherAlgo::correctBoundaryConditions
} }
// Multi-patch constraints // Multi-patch constraints
pointConstraints::New(displacement.mesh()).constrainCorners(displacement); pointConstraints::New(displacement.mesh()()).constrainCorners(displacement);
// Correct for problems introduced by corner constraints // Correct for problems introduced by corner constraints
syncTools::syncPointList syncTools::syncPointList

View File

@ -229,7 +229,7 @@ Foam::motionSmootherAlgo::avg
} }
// Single and multi-patch constraints // Single and multi-patch constraints
pointConstraints::New(res.mesh()).constrain(res, false); pointConstraints::New(mesh).constrain(res, false);
return tres; return tres;
} }
@ -256,7 +256,7 @@ void Foam::motionSmootherAlgo::smooth
} }
// Single and multi-patch constraints // Single and multi-patch constraints
pointConstraints::New(newFld.mesh()).constrain(newFld, false); pointConstraints::New(mesh_).constrain(newFld, false);
} }

View File

@ -51,11 +51,11 @@ void pointConstraints::makePatchPatchAddressing()
<< endl; << endl;
} }
const pointMesh& pMesh = mesh(); //const polyMesh& mesh = mesh();
const polyMesh& mesh = pMesh(); const pointMesh& pMesh = pointMesh::New(mesh());
const pointBoundaryMesh& pbm = pMesh.boundary(); const pointBoundaryMesh& pbm = pMesh.boundary();
const polyBoundaryMesh& bm = mesh.boundaryMesh(); const polyBoundaryMesh& bm = mesh().boundaryMesh();
// first count the total number of patch-patch points // first count the total number of patch-patch points
@ -146,7 +146,7 @@ void pointConstraints::makePatchPatchAddressing()
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{ {
const globalMeshData& gd = mesh.globalData(); const globalMeshData& gd = mesh().globalData();
const labelListList& globalPointSlaves = gd.globalPointSlaves(); const labelListList& globalPointSlaves = gd.globalPointSlaves();
const mapDistribute& globalPointSlavesMap = gd.globalPointSlavesMap(); const mapDistribute& globalPointSlavesMap = gd.globalPointSlavesMap();
const Map<label>& cpPointMap = gd.coupledPatch().meshPointMap(); const Map<label>& cpPointMap = gd.coupledPatch().meshPointMap();
@ -226,7 +226,7 @@ void pointConstraints::makePatchPatchAddressing()
{ {
//Pout<< "on meshpoint:" << meshPointI //Pout<< "on meshpoint:" << meshPointI
// << " coupled:" << coupledPointI // << " coupled:" << coupledPointI
// << " at:" << mesh.points()[meshPointI] // << " at:" << mesh().points()[meshPointI]
// << " have new constraint:" // << " have new constraint:"
// << constraints[coupledPointI] // << constraints[coupledPointI]
// << endl; // << endl;
@ -244,7 +244,7 @@ void pointConstraints::makePatchPatchAddressing()
{ {
//Pout<< "on meshpoint:" << meshPointI //Pout<< "on meshpoint:" << meshPointI
// << " coupled:" << coupledPointI // << " coupled:" << coupledPointI
// << " at:" << mesh.points()[meshPointI] // << " at:" << mesh().points()[meshPointI]
// << " have possibly extended constraint:" // << " have possibly extended constraint:"
// << constraints[coupledPointI] // << constraints[coupledPointI]
// << endl; // << endl;
@ -323,9 +323,10 @@ void pointConstraints::makePatchPatchAddressing()
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
pointConstraints::pointConstraints(const pointMesh& pm) //pointConstraints::pointConstraints(const pointMesh& pm)
pointConstraints::pointConstraints(const polyMesh& pm)
: :
MeshObject<pointMesh, Foam::UpdateableMeshObject, pointConstraints>(pm) MeshObject<polyMesh, Foam::UpdateableMeshObject, pointConstraints>(pm)
{ {
makePatchPatchAddressing(); makePatchPatchAddressing();
} }
@ -334,7 +335,12 @@ pointConstraints::pointConstraints(const pointMesh& pm)
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
pointConstraints::~pointConstraints() pointConstraints::~pointConstraints()
{} {
if (debug)
{
Pout<< "pointConstraints::~pointConstraints()" << endl;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -375,9 +381,9 @@ void pointConstraints::constrainDisplacement
// Apply any 2D motion constraints (or should they go before // Apply any 2D motion constraints (or should they go before
// corner constraints?) // corner constraints?)
twoDPointCorrector::New(mesh()()).correctDisplacement twoDPointCorrector::New(mesh()).correctDisplacement
( (
mesh()().points(), mesh().points(),
pf.internalField() pf.internalField()
); );

View File

@ -34,6 +34,11 @@ Description
coupled to points which are not on any constraint patch and we coupled to points which are not on any constraint patch and we
don't want to get inconsistency between the two points. don't want to get inconsistency between the two points.
Note: is currently MeshObject on polyMesh but should really be on
pointMesh. The problem is that pointMesh::updateMesh never
gets called (since currently polyMesh gets reset and destroys
pointMesh)
SourceFiles SourceFiles
pointConstraints.C pointConstraints.C
pointConstraintsTemplates.C pointConstraintsTemplates.C
@ -62,7 +67,8 @@ class polyMesh;
class pointConstraints class pointConstraints
: :
public MeshObject<pointMesh, UpdateableMeshObject, pointConstraints> //See above:public MeshObject<pointMesh, UpdateableMeshObject, pointConstraints>
public MeshObject<polyMesh, UpdateableMeshObject, pointConstraints>
{ {
// Private data // Private data
@ -97,7 +103,8 @@ public:
// Constructors // Constructors
//- Constructor from pointMesh. //- Constructor from pointMesh.
explicit pointConstraints(const pointMesh&); //explicit pointConstraints(const pointMesh&);
explicit pointConstraints(const polyMesh&);
//- Destructor //- Destructor

View File

@ -139,7 +139,12 @@ void pointConstraints::constrain
pf.correctBoundaryConditions(); pf.correctBoundaryConditions();
// Sync any dangling points // Sync any dangling points
syncUntransformedData(mesh()(), pf.internalField(), maxMagSqrEqOp<Type>()); syncUntransformedData
(
pf.mesh()(),
pf.internalField(),
maxMagSqrEqOp<Type>()
);
// Apply multiple constraints on edge/corner points // Apply multiple constraints on edge/corner points
constrainCorners(pf); constrainCorners(pf);

View File

@ -271,7 +271,7 @@ void volPointInterpolation::interpolateBoundaryField
interpolateBoundaryField(vf, pf); interpolateBoundaryField(vf, pf);
// Apply constraints // Apply constraints
const pointConstraints& pcs = pointConstraints::New(pf.mesh()); const pointConstraints& pcs = pointConstraints::New(vf.mesh());
pcs.constrain(pf, overrideFixedValue); pcs.constrain(pf, overrideFixedValue);
} }

View File

@ -390,7 +390,7 @@ void volPointInterpolation::interpolateDisplacement
interpolateBoundaryField(vf, pf); interpolateBoundaryField(vf, pf);
// Apply displacement constraints // Apply displacement constraints
const pointConstraints& pcs = pointConstraints::New(pf.mesh()); const pointConstraints& pcs = pointConstraints::New(vf.mesh());
pcs.constrainDisplacement(pf, false); pcs.constrainDisplacement(pf, false);
} }