See message about commiting the changes to fitting

This commit is contained in:
henry
2008-10-23 22:54:30 +01:00
12 changed files with 510 additions and 61 deletions

View File

@ -225,6 +225,8 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
// Dump halves // Dump halves
{ {
OFstream str(prefix+cycPatch.name()+"_half0.obj"); OFstream str(prefix+cycPatch.name()+"_half0.obj");
Pout<< "Dumping cycPatch.name() half0 faces to " << str.name()
<< endl;
meshTools::writeOBJ meshTools::writeOBJ
( (
str, str,
@ -241,6 +243,8 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
} }
{ {
OFstream str(prefix+cycPatch.name()+"_half1.obj"); OFstream str(prefix+cycPatch.name()+"_half1.obj");
Pout<< "Dumping cycPatch.name() half1 faces to " << str.name()
<< endl;
meshTools::writeOBJ meshTools::writeOBJ
( (
str, str,
@ -262,6 +266,9 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
OFstream str(prefix+cycPatch.name()+"_match.obj"); OFstream str(prefix+cycPatch.name()+"_match.obj");
label vertI = 0; label vertI = 0;
Pout<< "Dumping cyclic match as lines between face centres to "
<< str.name() << endl;
for (label faceI = 0; faceI < halfSize; faceI++) for (label faceI = 0; faceI < halfSize; faceI++)
{ {
const point& fc0 = mesh.faceCentres()[cycPatch.start()+faceI]; const point& fc0 = mesh.faceCentres()[cycPatch.start()+faceI];
@ -773,6 +780,8 @@ int main(int argc, char *argv[])
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, true); autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, true);
mesh.movePoints(map().preMotionPoints()); mesh.movePoints(map().preMotionPoints());
dumpCyclicMatch("coupled_", mesh);
// Synchronise points. // Synchronise points.
if (!pointSync) if (!pointSync)
{ {
@ -890,6 +899,8 @@ int main(int argc, char *argv[])
filterPatches(mesh); filterPatches(mesh);
dumpCyclicMatch("final_", mesh);
// Set the precision of the points data to 10 // Set the precision of the points data to 10
IOstream::defaultPrecision(10); IOstream::defaultPrecision(10);

View File

@ -1,77 +1,96 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.0 | | \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.openfoam.org | | \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format ascii; format ascii;
root "";
case "";
instance "system";
local "";
class dictionary; class dictionary;
object createPatcheDict; object createPatchDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Tolerance used in matching faces. Absolute tolerance is span of // This application/dictionary controls:
// face times this factor. // - optional: create new patches from boundary faces (either given as
matchTolerance 1E-6; // a set of patches or as a faceSet)
// - always: order faces on coupled patches such that they are opposite. This
// is done for all coupled faces, not just for any patches created.
// - optional: synchronise points on coupled patches.
// Do a synchronisation of coupled points. // 1. Create cyclic:
// - specify where the faces should come from
// - specify the type of cyclic. If a rotational specify the rotationAxis
// and centre to make matching easier
// - pointSync true to guarantee points to line up.
// 2. Correct incorrect cyclic:
// This will usually fail upon loading:
// "face 0 area does not match neighbour 2 by 0.0100005%"
// " -- possible face ordering problem."
// - change patch type from 'cyclic' to 'patch' in the polyMesh/boundary file.
// - loosen match tolerance to get case to load
// - regenerate cyclic as above
// Tolerance used in matching faces. Absolute tolerance is span of
// face times this factor. To load incorrectly matches meshes set this
// to a higher value.
matchTolerance 1E-3;
// Do a synchronisation of coupled points after creation of any patches.
pointSync true; pointSync true;
// Patches to create. // Patches to create.
// If no patches does a coupled point and face synchronisation anyway.
patches patches
( (
{ {
// Name of new patch // Name of new patch
name sidePatches; name sidePatches;
// Dictionary for new patch // Type of new patch
dictionary dictionary
{ {
type cyclic; type cyclic;
// Optional: used when matching and synchronising points.
// Optional: explicitly set transformation tensor.
// Used when matching and synchronising points.
//transform translational; //transform translational;
//separationVector (-2289 0 0); //separationVector (-2289 0 0);
transform rotational;
rotationAxis (1 0 0);
rotationCentre (0 0 0);
} }
// How to construct: either 'patches' or 'set' // How to construct: either from 'patches' or 'set'
constructFrom patches; constructFrom patches;
// If constructFrom = patches : names of patches // If constructFrom = patches : names of patches
//patches (periodic-1 periodic-2); patches (periodic-1 periodic-2);
patches (outlet-side1 outlet-side2);
// If constructFrom = set : name of faceSet // If constructFrom = set : name of faceSet
set f0; set f0;
} }
//{ {
// name bottom; name bottom;
// // Dictionary for new patch
// dictionary // Type of new patch
// { dictionary
// type patch; {
// } type wall;
// }
// constructFrom set;
// constructFrom set;
// patches (half0 half1);
// patches ();
// set bottomFaces;
//} set bottomFaces;
}
); );

View File

@ -320,9 +320,9 @@ void Foam::coupledPolyPatch::calcTransformTensors
if (debug) if (debug)
{ {
Pout<< " rotation " << sum(mag(forwardT_ - forwardT_[0])) Pout<< " difference in rotation less than"
<< " more than local tolerance " << error << " local tolerance "
<< ". Assuming uniform rotation." << endl; << error << ". Assuming uniform rotation." << endl;
} }
} }
} }

View File

@ -34,6 +34,7 @@ License
#include "matchPoints.H" #include "matchPoints.H"
#include "EdgeMap.H" #include "EdgeMap.H"
#include "Time.H" #include "Time.H"
#include "transformList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -89,6 +90,9 @@ void Foam::cyclicPolyPatch::calcTransforms()
{ {
const pointField& points = this->points(); const pointField& points = this->points();
// Determine geometric quantities on the two halves
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
primitivePatch half0 primitivePatch half0
( (
SubList<face> SubList<face>
@ -199,7 +203,57 @@ void Foam::cyclicPolyPatch::calcTransforms()
} }
// Calculate transformation tensors // See if transformation is prescribed
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
switch (transform_)
{
case ROTATIONAL:
{
// Specified single rotation tensor.
// Get best fitting face and its opposite number
label face0 = getConsistentRotationFace(half0Ctrs);
label face1 = face0;
vector n0 =
(
(half0Ctrs[face0] - rotationCentre_)
^ rotationAxis_
);
vector n1 =
(
(half1Ctrs[face1] - rotationCentre_)
^ -rotationAxis_
);
n0 /= mag(n0) + VSMALL;
n1 /= mag(n1) + VSMALL;
if (debug)
{
Pout<< "cyclicPolyPatch::calcTransforms :"
<< " Specified rotation :"
<< " n0:" << n0 << " n1:" << n1 << endl;
}
// Calculate transformation tensors from face0,1 only.
// Note: can use tight tolerance now.
calcTransformTensors
(
pointField(1, half0Ctrs[face0]),
pointField(1, half1Ctrs[face1]),
vectorField(1, n0),
vectorField(1, n1),
scalarField(1, half0Tols[face0]),
1E-4
);
break;
}
default:
{
// Calculate transformation tensors from all faces.
calcTransformTensors calcTransformTensors
( (
half0Ctrs, half0Ctrs,
@ -208,6 +262,10 @@ void Foam::cyclicPolyPatch::calcTransforms()
half1Normals, half1Normals,
half0Tols half0Tols
); );
break;
}
}
} }
} }
@ -402,6 +460,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
const faceList& half0Faces, const faceList& half0Faces,
const faceList& half1Faces, const faceList& half1Faces,
pointField& ppPoints,
pointField& half0Ctrs, pointField& half0Ctrs,
pointField& half1Ctrs, pointField& half1Ctrs,
pointField& anchors0, pointField& anchors0,
@ -442,6 +501,8 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
anchors0[faceI] = Foam::transform(reverseT, anchors0[faceI]); anchors0[faceI] = Foam::transform(reverseT, anchors0[faceI]);
} }
ppPoints = Foam::transform(reverseT, pp.points());
break; break;
} }
//- Problem: usually specified translation is not accurate enough //- Problem: usually specified translation is not accurate enough
@ -501,6 +562,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
anchors0[faceI] anchors0[faceI]
); );
} }
ppPoints = Foam::transform(reverseT, pp.points());
} }
else else
{ {
@ -524,6 +586,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
half0Ctrs += ctr1 - ctr0; half0Ctrs += ctr1 - ctr0;
anchors0 += ctr1 - ctr0; anchors0 += ctr1 - ctr0;
ppPoints = pp.points() + ctr1 - ctr0;
} }
break; break;
} }
@ -1079,7 +1142,7 @@ bool Foam::cyclicPolyPatch::order
faceList half1Faces(IndirectList<face>(pp, half1ToPatch)); faceList half1Faces(IndirectList<face>(pp, half1ToPatch));
// Get geometric quantities // Get geometric quantities
pointField half0Ctrs, half1Ctrs, anchors0; pointField half0Ctrs, half1Ctrs, anchors0, ppPoints;
scalarField tols; scalarField tols;
getCentresAndAnchors getCentresAndAnchors
( (
@ -1087,6 +1150,7 @@ bool Foam::cyclicPolyPatch::order
half0Faces, half0Faces,
half1Faces, half1Faces,
ppPoints,
half0Ctrs, half0Ctrs,
half1Ctrs, half1Ctrs,
anchors0, anchors0,
@ -1108,6 +1172,44 @@ bool Foam::cyclicPolyPatch::order
{ {
Pout<< "cyclicPolyPatch::order : test if already ordered:" Pout<< "cyclicPolyPatch::order : test if already ordered:"
<< matchedAll << endl; << matchedAll << endl;
// Dump halves
fileName nm0("match1_"+name()+"_half0_faces.obj");
Pout<< "cyclicPolyPatch::order : Writing half0"
<< " faces to OBJ file " << nm0 << endl;
writeOBJ(nm0, half0Faces, ppPoints);
fileName nm1("match1_"+name()+"_half1_faces.obj");
Pout<< "cyclicPolyPatch::order : Writing half1"
<< " faces to OBJ file " << nm1 << endl;
writeOBJ(nm1, half1Faces, pp.points());
OFstream ccStr
(
boundaryMesh().mesh().time().path()
/"match1_"+ name() + "_faceCentres.obj"
);
Pout<< "cyclicPolyPatch::order : "
<< "Dumping currently found cyclic match as lines between"
<< " corresponding face centres to file " << ccStr.name()
<< endl;
// Recalculate untransformed face centres
//pointField rawHalf0Ctrs = calcFaceCentres(half0Faces, pp.points());
label vertI = 0;
forAll(half1Ctrs, i)
{
//if (from1To0[i] != -1)
{
// Write edge between c1 and c0
//const point& c0 = rawHalf0Ctrs[from1To0[i]];
//const point& c0 = half0Ctrs[from1To0[i]];
const point& c0 = half0Ctrs[i];
const point& c1 = half1Ctrs[i];
writeOBJ(ccStr, c0, c1, vertI);
}
}
} }
@ -1133,6 +1235,7 @@ bool Foam::cyclicPolyPatch::order
half0Faces, half0Faces,
half1Faces, half1Faces,
ppPoints,
half0Ctrs, half0Ctrs,
half1Ctrs, half1Ctrs,
anchors0, anchors0,
@ -1153,6 +1256,42 @@ bool Foam::cyclicPolyPatch::order
{ {
Pout<< "cyclicPolyPatch::order : test if pairwise ordered:" Pout<< "cyclicPolyPatch::order : test if pairwise ordered:"
<< matchedAll << endl; << matchedAll << endl;
// Dump halves
fileName nm0("match2_"+name()+"_half0_faces.obj");
Pout<< "cyclicPolyPatch::order : Writing half0"
<< " faces to OBJ file " << nm0 << endl;
writeOBJ(nm0, half0Faces, ppPoints);
fileName nm1("match2_"+name()+"_half1_faces.obj");
Pout<< "cyclicPolyPatch::order : Writing half1"
<< " faces to OBJ file " << nm1 << endl;
writeOBJ(nm1, half1Faces, pp.points());
OFstream ccStr
(
boundaryMesh().mesh().time().path()
/"match2_"+name()+"_faceCentres.obj"
);
Pout<< "cyclicPolyPatch::order : "
<< "Dumping currently found cyclic match as lines between"
<< " corresponding face centres to file " << ccStr.name()
<< endl;
// Recalculate untransformed face centres
//pointField rawHalf0Ctrs = calcFaceCentres(half0Faces, pp.points());
label vertI = 0;
forAll(half1Ctrs, i)
{
if (from1To0[i] != -1)
{
// Write edge between c1 and c0
//const point& c0 = rawHalf0Ctrs[from1To0[i]];
const point& c0 = half0Ctrs[from1To0[i]];
const point& c1 = half1Ctrs[i];
writeOBJ(ccStr, c0, c1, vertI);
}
}
} }
} }
@ -1209,6 +1348,7 @@ bool Foam::cyclicPolyPatch::order
half0Faces, half0Faces,
half1Faces, half1Faces,
ppPoints,
half0Ctrs, half0Ctrs,
half1Ctrs, half1Ctrs,
anchors0, anchors0,
@ -1229,8 +1369,43 @@ bool Foam::cyclicPolyPatch::order
{ {
Pout<< "cyclicPolyPatch::order : test if baffles:" Pout<< "cyclicPolyPatch::order : test if baffles:"
<< matchedAll << endl; << matchedAll << endl;
} // Dump halves
fileName nm0("match3_"+name()+"_half0_faces.obj");
Pout<< "cyclicPolyPatch::order : Writing half0"
<< " faces to OBJ file " << nm0 << endl;
writeOBJ(nm0, half0Faces, ppPoints);
fileName nm1("match3_"+name()+"_half1_faces.obj");
Pout<< "cyclicPolyPatch::order : Writing half1"
<< " faces to OBJ file " << nm1 << endl;
writeOBJ(nm1, half1Faces, pp.points());
OFstream ccStr
(
boundaryMesh().mesh().time().path()
/"match3_"+ name() + "_faceCentres.obj"
);
Pout<< "cyclicPolyPatch::order : "
<< "Dumping currently found cyclic match as lines between"
<< " corresponding face centres to file " << ccStr.name()
<< endl;
// Recalculate untransformed face centres
//pointField rawHalf0Ctrs = calcFaceCentres(half0Faces, pp.points());
label vertI = 0;
forAll(half1Ctrs, i)
{
if (from1To0[i] != -1)
{
// Write edge between c1 and c0
//const point& c0 = rawHalf0Ctrs[from1To0[i]];
const point& c0 = half0Ctrs[from1To0[i]];
const point& c1 = half1Ctrs[i];
writeOBJ(ccStr, c0, c1, vertI);
}
}
}
} }
} }
@ -1259,6 +1434,7 @@ bool Foam::cyclicPolyPatch::order
half0Faces, half0Faces,
half1Faces, half1Faces,
ppPoints,
half0Ctrs, half0Ctrs,
half1Ctrs, half1Ctrs,
anchors0, anchors0,
@ -1279,6 +1455,42 @@ bool Foam::cyclicPolyPatch::order
{ {
Pout<< "cyclicPolyPatch::order : automatic ordering result:" Pout<< "cyclicPolyPatch::order : automatic ordering result:"
<< matchedAll << endl; << matchedAll << endl;
// Dump halves
fileName nm0("match4_"+name()+"_half0_faces.obj");
Pout<< "cyclicPolyPatch::order : Writing half0"
<< " faces to OBJ file " << nm0 << endl;
writeOBJ(nm0, half0Faces, ppPoints);
fileName nm1("match4_"+name()+"_half1_faces.obj");
Pout<< "cyclicPolyPatch::order : Writing half1"
<< " faces to OBJ file " << nm1 << endl;
writeOBJ(nm1, half1Faces, pp.points());
OFstream ccStr
(
boundaryMesh().mesh().time().path()
/"match4_"+ name() + "_faceCentres.obj"
);
Pout<< "cyclicPolyPatch::order : "
<< "Dumping currently found cyclic match as lines between"
<< " corresponding face centres to file " << ccStr.name()
<< endl;
// Recalculate untransformed face centres
//pointField rawHalf0Ctrs = calcFaceCentres(half0Faces, pp.points());
label vertI = 0;
forAll(half1Ctrs, i)
{
if (from1To0[i] != -1)
{
// Write edge between c1 and c0
//const point& c0 = rawHalf0Ctrs[from1To0[i]];
const point& c0 = half0Ctrs[from1To0[i]];
const point& c1 = half1Ctrs[i];
writeOBJ(ccStr, c0, c1, vertI);
}
}
} }
} }

View File

@ -141,6 +141,7 @@ private:
const faceList& half0Faces, const faceList& half0Faces,
const faceList& half1Faces, const faceList& half1Faces,
pointField& ppPoints,
pointField& half0Ctrs, pointField& half0Ctrs,
pointField& half1Ctrs, pointField& half1Ctrs,
pointField& anchors0, pointField& anchors0,

View File

@ -152,6 +152,11 @@ Foam::label Foam::autoLayerDriver::mergePatchFacesUndo
{ {
mesh.movePoints(map().preMotionPoints()); mesh.movePoints(map().preMotionPoints());
} }
else
{
// Delete mesh volumes.
mesh.clearOut();
}
faceCombiner.updateMesh(map); faceCombiner.updateMesh(map);
@ -301,6 +306,11 @@ Foam::label Foam::autoLayerDriver::mergePatchFacesUndo
{ {
mesh.movePoints(map().preMotionPoints()); mesh.movePoints(map().preMotionPoints());
} }
else
{
// Delete mesh volumes.
mesh.clearOut();
}
faceCombiner.updateMesh(map); faceCombiner.updateMesh(map);
@ -363,6 +373,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoLayerDriver::doRemovePoints
{ {
mesh.movePoints(map().preMotionPoints()); mesh.movePoints(map().preMotionPoints());
} }
else
{
// Delete mesh volumes.
mesh.clearOut();
}
pointRemover.updateMesh(map); pointRemover.updateMesh(map);
meshRefiner_.updateMesh(map, labelList(0)); meshRefiner_.updateMesh(map, labelList(0));
@ -411,6 +426,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoLayerDriver::doRestorePoints
{ {
mesh.movePoints(map().preMotionPoints()); mesh.movePoints(map().preMotionPoints());
} }
else
{
// Delete mesh volumes.
mesh.clearOut();
}
pointRemover.updateMesh(map); pointRemover.updateMesh(map);
meshRefiner_.updateMesh(map, labelList(0)); meshRefiner_.updateMesh(map, labelList(0));
@ -2782,6 +2802,10 @@ void Foam::autoLayerDriver::addLayers
const_cast<Time&>(mesh.time())++; const_cast<Time&>(mesh.time())++;
Info<< "Writing shrunk mesh to " << mesh.time().timeName() << endl; Info<< "Writing shrunk mesh to " << mesh.time().timeName() << endl;
// See comment in autoSnapDriver why we should not remove meshPhi
// using mesh.clearPout().
mesh.write(); mesh.write();
} }
@ -2970,6 +2994,11 @@ void Foam::autoLayerDriver::addLayers
{ {
mesh.movePoints(map().preMotionPoints()); mesh.movePoints(map().preMotionPoints());
} }
else
{
// Delete mesh volumes.
mesh.clearOut();
}
meshRefiner_.updateMesh(map, labelList(0)); meshRefiner_.updateMesh(map, labelList(0));

View File

@ -930,6 +930,7 @@ void Foam::autoSnapDriver::preSmoothPatch
const_cast<Time&>(mesh.time())++; const_cast<Time&>(mesh.time())++;
Pout<< "Writing patch smoothed mesh to time " << mesh.time().timeName() Pout<< "Writing patch smoothed mesh to time " << mesh.time().timeName()
<< endl; << endl;
mesh.write(); mesh.write();
} }
@ -1220,6 +1221,11 @@ void Foam::autoSnapDriver::smoothDisplacement
const_cast<Time&>(mesh.time())++; const_cast<Time&>(mesh.time())++;
Pout<< "Writing smoothed mesh to time " << mesh.time().timeName() Pout<< "Writing smoothed mesh to time " << mesh.time().timeName()
<< endl; << endl;
// Moving mesh creates meshPhi. Can be cleared out by a mesh.clearOut
// but this will also delete all pointMesh but not pointFields which
// gives an illegal situation.
mesh.write(); mesh.write();
Pout<< "Writing displacement field ..." << endl; Pout<< "Writing displacement field ..." << endl;

View File

@ -458,6 +458,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createBaffles
{ {
mesh_.movePoints(map().preMotionPoints()); mesh_.movePoints(map().preMotionPoints());
} }
else
{
// Delete mesh volumes.
mesh_.clearOut();
}
//- Redo the intersections on the newly create baffle faces. Note that //- Redo the intersections on the newly create baffle faces. Note that
// this changes also the cell centre positions. // this changes also the cell centre positions.
@ -1448,6 +1453,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles
{ {
mesh_.movePoints(map().preMotionPoints()); mesh_.movePoints(map().preMotionPoints());
} }
else
{
// Delete mesh volumes.
mesh_.clearOut();
}
// Update intersections. Recalculate intersections on merged faces since // Update intersections. Recalculate intersections on merged faces since
// this seems to give problems? Note: should not be nessecary since // this seems to give problems? Note: should not be nessecary since
@ -2405,6 +2415,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints()
{ {
mesh_.movePoints(map().preMotionPoints()); mesh_.movePoints(map().preMotionPoints());
} }
else
{
// Delete mesh volumes.
mesh_.clearOut();
}
// Update intersections. Is mapping only (no faces created, positions stay // Update intersections. Is mapping only (no faces created, positions stay
// same) so no need to recalculate intersections. // same) so no need to recalculate intersections.
@ -2828,6 +2843,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
{ {
mesh_.movePoints(map().preMotionPoints()); mesh_.movePoints(map().preMotionPoints());
} }
else
{
// Delete mesh volumes.
mesh_.clearOut();
}
return map; return map;
} }

View File

@ -835,7 +835,7 @@ Foam::label Foam::meshRefinement::markSurfaceCurvatureRefinement
// minLevel) and cache per cell the max surface level and the local normal // minLevel) and cache per cell the max surface level and the local normal
// on that surface. // on that surface.
labelList cellMaxLevel(mesh_.nCells(), -1); labelList cellMaxLevel(mesh_.nCells(), -1);
vectorField cellMaxNormal(mesh_.nCells()); vectorField cellMaxNormal(mesh_.nCells(), vector::zero);
{ {
// Per segment the normals of the surfaces // Per segment the normals of the surfaces
@ -1226,6 +1226,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::refine
{ {
mesh_.movePoints(map().preMotionPoints()); mesh_.movePoints(map().preMotionPoints());
} }
else
{
// Delete mesh volumes.
mesh_.clearOut();
}
// Update intersection info // Update intersection info
updateMesh(map, getChangedFaces(map, cellsToRefine)); updateMesh(map, getChangedFaces(map, cellsToRefine));

View File

@ -780,9 +780,6 @@ Foam::tmp<Foam::scalarField> Foam::motionSmoother::movePoints
tmp<scalarField> tsweptVol = mesh_.movePoints(newPoints); tmp<scalarField> tsweptVol = mesh_.movePoints(newPoints);
//!!! Workaround for movePoints bug
const_cast<polyBoundaryMesh&>(mesh_.boundaryMesh()).movePoints(newPoints);
pp_.movePoints(mesh_.points()); pp_.movePoints(mesh_.points());
return tsweptVol; return tsweptVol;

View File

@ -42,9 +42,15 @@ License
#include "extendedLeastSquaresVectors.H" #include "extendedLeastSquaresVectors.H"
#include "extendedLeastSquaresVectors.H" #include "extendedLeastSquaresVectors.H"
#include "leastSquaresVectors.H" #include "leastSquaresVectors.H"
<<<<<<< HEAD:src/finiteVolume/fvMesh/fvMesh.C
#include "CentredFitData.H" #include "CentredFitData.H"
#include "linearFitPolynomial.H" #include "linearFitPolynomial.H"
#include "quadraticLinearFitPolynomial.H" #include "quadraticLinearFitPolynomial.H"
=======
//#include "linearFitData.H"
//#include "quadraticFitData.H"
//#include "quadraticFitSnGradData.H"
>>>>>>> a5197e512825ed4dd1a45d45c1706c8b56f61489:src/finiteVolume/fvMesh/fvMesh.C
#include "skewCorrectionVectors.H" #include "skewCorrectionVectors.H"
#include "centredCECStencilObject.H" #include "centredCECStencilObject.H"
@ -94,8 +100,14 @@ void Foam::fvMesh::clearGeom()
extendedLeastSquaresVectors::Delete(*this); extendedLeastSquaresVectors::Delete(*this);
extendedLeastSquaresVectors::Delete(*this); extendedLeastSquaresVectors::Delete(*this);
leastSquaresVectors::Delete(*this); leastSquaresVectors::Delete(*this);
<<<<<<< HEAD:src/finiteVolume/fvMesh/fvMesh.C
CentredFitData<linearFitPolynomial>::Delete(*this); CentredFitData<linearFitPolynomial>::Delete(*this);
CentredFitData<quadraticLinearFitPolynomial>::Delete(*this); CentredFitData<quadraticLinearFitPolynomial>::Delete(*this);
=======
//linearFitData::Delete(*this);
//quadraticFitData::Delete(*this);
//quadraticFitSnGradData::Delete(*this);
>>>>>>> a5197e512825ed4dd1a45d45c1706c8b56f61489:src/finiteVolume/fvMesh/fvMesh.C
skewCorrectionVectors::Delete(*this); skewCorrectionVectors::Delete(*this);
} }
@ -110,8 +122,14 @@ void Foam::fvMesh::clearAddressing()
extendedLeastSquaresVectors::Delete(*this); extendedLeastSquaresVectors::Delete(*this);
extendedLeastSquaresVectors::Delete(*this); extendedLeastSquaresVectors::Delete(*this);
leastSquaresVectors::Delete(*this); leastSquaresVectors::Delete(*this);
<<<<<<< HEAD:src/finiteVolume/fvMesh/fvMesh.C
CentredFitData<linearFitPolynomial>::Delete(*this); CentredFitData<linearFitPolynomial>::Delete(*this);
CentredFitData<quadraticLinearFitPolynomial>::Delete(*this); CentredFitData<quadraticLinearFitPolynomial>::Delete(*this);
=======
//linearFitData::Delete(*this);
//quadraticFitData::Delete(*this);
//quadraticFitSnGradData::Delete(*this);
>>>>>>> a5197e512825ed4dd1a45d45c1706c8b56f61489:src/finiteVolume/fvMesh/fvMesh.C
skewCorrectionVectors::Delete(*this); skewCorrectionVectors::Delete(*this);
centredCECStencilObject::Delete(*this); centredCECStencilObject::Delete(*this);
@ -662,12 +680,142 @@ Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
// Hack until proper callbacks. Below are all the fvMesh MeshObjects with a // Hack until proper callbacks. Below are all the fvMesh MeshObjects with a
// movePoints function. // movePoints function.
<<<<<<< HEAD:src/finiteVolume/fvMesh/fvMesh.C
MeshObjectMovePoints<volPointInterpolation>(*this); MeshObjectMovePoints<volPointInterpolation>(*this);
MeshObjectMovePoints<extendedLeastSquaresVectors>(*this); MeshObjectMovePoints<extendedLeastSquaresVectors>(*this);
MeshObjectMovePoints<leastSquaresVectors>(*this); MeshObjectMovePoints<leastSquaresVectors>(*this);
MeshObjectMovePoints<CentredFitData<linearFitPolynomial> >(*this); MeshObjectMovePoints<CentredFitData<linearFitPolynomial> >(*this);
MeshObjectMovePoints<CentredFitData<quadraticLinearFitPolynomial> >(*this); MeshObjectMovePoints<CentredFitData<quadraticLinearFitPolynomial> >(*this);
MeshObjectMovePoints<skewCorrectionVectors>(*this); MeshObjectMovePoints<skewCorrectionVectors>(*this);
=======
// volPointInterpolation
if
(
db().objectRegistry::foundObject<volPointInterpolation>
(
volPointInterpolation::typeName
)
)
{
const_cast<volPointInterpolation&>
(
db().objectRegistry::lookupObject<volPointInterpolation>
(
volPointInterpolation::typeName
)
).movePoints();
}
// extendedLeastSquaresVectors
if
(
db().objectRegistry::foundObject<extendedLeastSquaresVectors>
(
extendedLeastSquaresVectors::typeName
)
)
{
const_cast<extendedLeastSquaresVectors&>
(
db().objectRegistry::lookupObject<extendedLeastSquaresVectors>
(
extendedLeastSquaresVectors::typeName
)
).movePoints();
}
// leastSquaresVectors
if
(
db().objectRegistry::foundObject<leastSquaresVectors>
(
leastSquaresVectors::typeName
)
)
{
const_cast<leastSquaresVectors&>
(
db().objectRegistry::lookupObject<leastSquaresVectors>
(
leastSquaresVectors::typeName
)
).movePoints();
}
//// linearFitData
//if
//(
// db().objectRegistry::foundObject<linearFitData>
// (
// linearFitData::typeName
// )
//)
//{
// const_cast<linearFitData&>
// (
// db().objectRegistry::lookupObject<linearFitData>
// (
// linearFitData::typeName
// )
// ).movePoints();
//}
//// quadraticFitData
//if
//(
// db().objectRegistry::foundObject<quadraticFitData>
// (
// quadraticFitData::typeName
// )
//)
//{
// const_cast<quadraticFitData&>
// (
// db().objectRegistry::lookupObject<quadraticFitData>
// (
// quadraticFitData::typeName
// )
// ).movePoints();
//}
//// quadraticFitSnGradData
//if
//(
// db().objectRegistry::foundObject<quadraticFitSnGradData>
// (
// quadraticFitSnGradData::typeName
// )
//)
//{
// const_cast<quadraticFitSnGradData&>
// (
// db().objectRegistry::lookupObject<quadraticFitSnGradData>
// (
// quadraticFitSnGradData::typeName
// )
// ).movePoints();
//}
// skewCorrectionVectors
if
(
db().objectRegistry::foundObject<skewCorrectionVectors>
(
skewCorrectionVectors::typeName
)
)
{
const_cast<skewCorrectionVectors&>
(
db().objectRegistry::lookupObject<skewCorrectionVectors>
(
skewCorrectionVectors::typeName
)
).movePoints();
}
>>>>>>> a5197e512825ed4dd1a45d45c1706c8b56f61489:src/finiteVolume/fvMesh/fvMesh.C
return tsweptVols; return tsweptVols;
} }

View File

@ -2192,9 +2192,10 @@ bool Foam::distributedTriSurfaceMesh::writeObject
// Make sure dictionary goes to same directory as surface // Make sure dictionary goes to same directory as surface
const_cast<fileName&>(dict_.instance()) = searchableSurface::instance(); const_cast<fileName&>(dict_.instance()) = searchableSurface::instance();
// Dictionary needs to be written in ascii - binary output not supported.
return return
triSurfaceMesh::writeObject(fmt, ver, cmp) triSurfaceMesh::writeObject(fmt, ver, cmp)
&& dict_.writeObject(fmt, ver, cmp); && dict_.writeObject(IOstream::ASCII, ver, cmp);
} }