Commit 3aed3c45 authored by mattijs's avatar mattijs
Browse files

STYLE: added code for using isoSurfaceCell. Removed cleanup of surface.

parent 8c454d5e
......@@ -2054,61 +2054,68 @@ Foam::isoSurface::isoSurface
}
//if (false)
//{
List<FixedList<label, 3> > faceEdges;
labelList edgeFace0, edgeFace1;
Map<labelList> edgeFacesRest;
while (true)
if (false)
{
// Calculate addressing
calcAddressing(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest);
List<FixedList<label, 3> > faceEdges;
labelList edgeFace0, edgeFace1;
Map<labelList> edgeFacesRest;
// See if any dangling triangles
boolList keepTriangles;
label nDangling = markDanglingTriangles
(
faceEdges,
edgeFace0,
edgeFace1,
edgeFacesRest,
keepTriangles
);
if (debug)
while (true)
{
Pout<< "isoSurface : detected " << nDangling
<< " dangling triangles." << endl;
}
// Calculate addressing
calcAddressing
(
*this,
faceEdges,
edgeFace0,
edgeFace1,
edgeFacesRest
);
if (nDangling == 0)
{
break;
}
// See if any dangling triangles
boolList keepTriangles;
label nDangling = markDanglingTriangles
(
faceEdges,
edgeFace0,
edgeFace1,
edgeFacesRest,
keepTriangles
);
// Create face map (new to old)
labelList subsetTriMap(findIndices(keepTriangles, true));
if (debug)
{
Pout<< "isoSurface : detected " << nDangling
<< " dangling triangles." << endl;
}
labelList subsetPointMap;
labelList reversePointMap;
triSurface::operator=
(
subsetMesh
if (nDangling == 0)
{
break;
}
// Create face map (new to old)
labelList subsetTriMap(findIndices(keepTriangles, true));
labelList subsetPointMap;
labelList reversePointMap;
triSurface::operator=
(
*this,
subsetTriMap,
reversePointMap,
subsetPointMap
)
);
meshCells_ = labelField(meshCells_, subsetTriMap);
inplaceRenumber(reversePointMap, triPointMergeMap_);
}
subsetMesh
(
*this,
subsetTriMap,
reversePointMap,
subsetPointMap
)
);
meshCells_ = labelField(meshCells_, subsetTriMap);
inplaceRenumber(reversePointMap, triPointMergeMap_);
}
orientSurface(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest);
//}
orientSurface(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest);
}
if (debug)
......
......@@ -1398,6 +1398,8 @@ Foam::isoSurfaceCell::isoSurfaceCell
)
:
mesh_(mesh),
cVals_(cVals),
pVals_(pVals),
iso_(iso),
mergeDistance_(mergeTol*mesh.bounds().mag())
{
......@@ -1563,59 +1565,68 @@ Foam::isoSurfaceCell::isoSurfaceCell
}
List<FixedList<label, 3> > faceEdges;
labelList edgeFace0, edgeFace1;
Map<labelList> edgeFacesRest;
while (true)
if (false)
{
// Calculate addressing
calcAddressing(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest);
List<FixedList<label, 3> > faceEdges;
labelList edgeFace0, edgeFace1;
Map<labelList> edgeFacesRest;
// See if any dangling triangles
boolList keepTriangles;
label nDangling = markDanglingTriangles
(
faceEdges,
edgeFace0,
edgeFace1,
edgeFacesRest,
keepTriangles
);
if (debug)
while (true)
{
Pout<< "isoSurfaceCell : detected " << nDangling
<< " dangling triangles." << endl;
}
// Calculate addressing
calcAddressing
(
*this,
faceEdges,
edgeFace0,
edgeFace1,
edgeFacesRest
);
if (nDangling == 0)
{
break;
}
// See if any dangling triangles
boolList keepTriangles;
label nDangling = markDanglingTriangles
(
faceEdges,
edgeFace0,
edgeFace1,
edgeFacesRest,
keepTriangles
);
// Create face map (new to old)
labelList subsetTriMap(findIndices(keepTriangles, true));
if (debug)
{
Pout<< "isoSurfaceCell : detected " << nDangling
<< " dangling triangles." << endl;
}
labelList subsetPointMap;
labelList reversePointMap;
triSurface::operator=
(
subsetMesh
(
*this,
subsetTriMap,
reversePointMap,
subsetPointMap
)
);
meshCells_ = labelField(meshCells_, subsetTriMap);
inplaceRenumber(reversePointMap, triPointMergeMap_);
}
if (nDangling == 0)
{
break;
}
orientSurface(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest);
// Create face map (new to old)
labelList subsetTriMap(findIndices(keepTriangles, true));
labelList subsetPointMap;
labelList reversePointMap;
triSurface::operator=
(
subsetMesh
(
*this,
subsetTriMap,
reversePointMap,
subsetPointMap
)
);
meshCells_ = labelField(meshCells_, subsetTriMap);
inplaceRenumber(reversePointMap, triPointMergeMap_);
}
orientSurface(*this, faceEdges, edgeFace0, edgeFace1, edgeFacesRest);
}
//combineCellTriangles();
}
......
......@@ -85,6 +85,10 @@ class isoSurfaceCell
//- Reference to mesh
const polyMesh& mesh_;
const scalarField& cVals_;
const scalarField& pVals_;
//- isoSurfaceCell value
const scalar iso_;
......@@ -352,6 +356,14 @@ public:
const Field<Type>& cCoords,
const Field<Type>& pCoords
) const;
//- Interpolates cCoords,pCoords.
template <class Type>
tmp<Field<Type> > interpolate
(
const Field<Type>& cCoords,
const Field<Type>& pCoords
) const;
};
......
......@@ -381,4 +381,56 @@ Foam::isoSurfaceCell::interpolate
}
template <class Type>
Foam::tmp<Foam::Field<Type> >
Foam::isoSurfaceCell::interpolate
(
const Field<Type>& cCoords,
const Field<Type>& pCoords
) const
{
DynamicList<Type> triPoints(nCutCells_);
DynamicList<label> triMeshCells(nCutCells_);
// Dummy snap data
DynamicList<Type> snappedPoints;
labelList snappedCc(mesh_.nCells(), -1);
labelList snappedPoint(mesh_.nPoints(), -1);
generateTriPoints
(
cVals_,
pVals_,
cCoords,
pCoords,
snappedPoints,
snappedCc,
snappedPoint,
triPoints,
triMeshCells
);
// One value per point
tmp<Field<Type> > tvalues(new Field<Type>(points().size()));
Field<Type>& values = tvalues();
forAll(triPoints, i)
{
label mergedPointI = triPointMergeMap_[i];
if (mergedPointI >= 0)
{
values[mergedPointI] = triPoints[i];
}
}
return tvalues;
}
// ************************************************************************* //
......@@ -30,7 +30,6 @@ License
#include "volPointInterpolation.H"
#include "addToRunTimeSelectionTable.H"
#include "fvMesh.H"
#include "isoSurface.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -173,7 +172,7 @@ void Foam::sampledCuttingPlane::createGeometry()
forAll(fld, i)
{
fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal();
fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal();
}
}
}
......@@ -231,6 +230,14 @@ void Foam::sampledCuttingPlane::createGeometry()
0.0,
regularise_
)
//new isoSurfaceCell
//(
// fvm,
// cellDistance,
// pointDistance_,
// 0.0,
// regularise_
//)
);
if (debug)
......
......@@ -38,6 +38,7 @@ SourceFiles
#include "sampledSurface.H"
#include "isoSurface.H"
//#include "isoSurfaceCell.H"
#include "plane.H"
#include "ZoneIDs.H"
#include "fvMeshSubset.H"
......@@ -89,6 +90,7 @@ class sampledCuttingPlane
scalarField pointDistance_;
//- Constructed iso surface
//autoPtr<isoSurfaceCell> isoSurfPtr_;
autoPtr<isoSurface> isoSurfPtr_;
//- triangles converted to faceList
......@@ -173,6 +175,7 @@ public:
}
//const isoSurfaceCell& surface() const
const isoSurface& surface() const
{
return isoSurfPtr_();
......
......@@ -26,7 +26,6 @@ License
#include "volPointInterpolation.H"
#include "sampledCuttingPlane.H"
#include "isoSurface.H"
#include "volFieldsFwd.H"
#include "pointFields.H"
#include "volPointInterpolation.H"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment