ENH: meshRefinement: utility functions for checking sync

This commit is contained in:
mattijs 2013-01-10 12:33:46 +00:00
parent 6f2c111752
commit b734b860f1
2 changed files with 116 additions and 2 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -258,6 +258,106 @@ void Foam::meshRefinement::updateIntersections(const labelList& changedFaces)
}
void Foam::meshRefinement::testSyncPointList
(
const string& msg,
const polyMesh& mesh,
const List<scalar>& fld
)
{
if (fld.size() != mesh.nPoints())
{
FatalErrorIn
(
"meshRefinement::testSyncPointList(const polyMesh&"
", const List<scalar>&)"
) << msg << endl
<< "fld size:" << fld.size() << " mesh points:" << mesh.nPoints()
<< abort(FatalError);
}
Pout<< "Checking field " << msg << endl;
scalarField minFld(fld);
syncTools::syncPointList
(
mesh,
minFld,
minEqOp<scalar>(),
GREAT
);
scalarField maxFld(fld);
syncTools::syncPointList
(
mesh,
maxFld,
maxEqOp<scalar>(),
-GREAT
);
forAll(minFld, pointI)
{
const scalar& minVal = minFld[pointI];
const scalar& maxVal = maxFld[pointI];
if (mag(minVal-maxVal) > SMALL)
{
Pout<< msg << " at:" << mesh.points()[pointI] << nl
<< " minFld:" << minVal << nl
<< " maxFld:" << maxVal << nl
<< endl;
}
}
}
void Foam::meshRefinement::testSyncPointList
(
const string& msg,
const polyMesh& mesh,
const List<point>& fld
)
{
if (fld.size() != mesh.nPoints())
{
FatalErrorIn
(
"meshRefinement::testSyncPointList(const polyMesh&"
", const List<point>&)"
) << msg << endl
<< "fld size:" << fld.size() << " mesh points:" << mesh.nPoints()
<< abort(FatalError);
}
Pout<< "Checking field " << msg << endl;
pointField minFld(fld);
syncTools::syncPointList
(
mesh,
minFld,
minMagSqrEqOp<point>(),
point(GREAT, GREAT, GREAT)
);
pointField maxFld(fld);
syncTools::syncPointList
(
mesh,
maxFld,
maxMagSqrEqOp<point>(),
vector::zero
);
forAll(minFld, pointI)
{
const point& minVal = minFld[pointI];
const point& maxVal = maxFld[pointI];
if (mag(minVal-maxVal) > SMALL)
{
Pout<< msg << " at:" << mesh.points()[pointI] << nl
<< " minFld:" << minVal << nl
<< " maxFld:" << maxVal << nl
<< endl;
}
}
}
void Foam::meshRefinement::checkData()
{
Pout<< "meshRefinement::checkData() : Checking refinement structure."

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -879,6 +879,20 @@ public:
//- Debugging: check that all faces still obey start()>end()
void checkData();
static void testSyncPointList
(
const string& msg,
const polyMesh& mesh,
const List<scalar>& fld
);
static void testSyncPointList
(
const string& msg,
const polyMesh& mesh,
const List<point>& fld
);
//- Compare two lists over all boundary faces
template<class T>
void testSyncBoundaryFaceList