mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'cvMesh-automaticCellSize'
This commit is contained in:
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -42,6 +42,8 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
timeSelector::addOptions();
|
||||||
|
|
||||||
# include "addOverwriteOption.H"
|
# include "addOverwriteOption.H"
|
||||||
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
@ -49,7 +51,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
# include "createMesh.H"
|
# include "createNamedPolyMesh.H"
|
||||||
|
|
||||||
runTime.functionObjects().off();
|
runTime.functionObjects().off();
|
||||||
|
|
||||||
@ -57,14 +59,11 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
runTime.setTime(timeDirs[timeI], timeI);
|
runTime.setTime(timeDirs[timeI], timeI);
|
||||||
|
|
||||||
Info<< "Create mesh for time = " << runTime.timeName()
|
Info<< "Time = " << runTime.timeName()
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
|
|
||||||
mesh.readUpdate();
|
mesh.readUpdate();
|
||||||
|
|
||||||
Info<< "Read mesh in = "
|
|
||||||
<< runTime.cpuTimeIncrement() << " s" << endl;
|
|
||||||
|
|
||||||
// Check patches and faceZones are synchronised
|
// Check patches and faceZones are synchronised
|
||||||
mesh.boundaryMesh().checkParallelSync(true);
|
mesh.boundaryMesh().checkParallelSync(true);
|
||||||
meshRefinement::checkCoupledFaceZones(mesh);
|
meshRefinement::checkCoupledFaceZones(mesh);
|
||||||
@ -87,8 +86,10 @@ int main(int argc, char *argv[])
|
|||||||
= cvMeshDict.subDict("meshQualityControls");
|
= cvMeshDict.subDict("meshQualityControls");
|
||||||
|
|
||||||
|
|
||||||
Info<< "Checking initial mesh ..." << endl;
|
Info<< "Checking mesh ..." << endl;
|
||||||
|
|
||||||
faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100);
|
faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100);
|
||||||
|
|
||||||
motionSmoother::checkMesh(false, mesh, meshQualityDict, wrongFaces);
|
motionSmoother::checkMesh(false, mesh, meshQualityDict, wrongFaces);
|
||||||
|
|
||||||
const label nInitErrors = returnReduce
|
const label nInitErrors = returnReduce
|
||||||
@ -117,6 +118,5 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,13 +15,23 @@ backgroundMeshDecomposition/backgroundMeshDecomposition.C
|
|||||||
|
|
||||||
cellSizeControlSurfaces/cellSizeControlSurfaces.C
|
cellSizeControlSurfaces/cellSizeControlSurfaces.C
|
||||||
|
|
||||||
cellSiseFunctions = cellSizeControlSurfaces/cellSizeFunction
|
cellSizeFunctions = cellSizeControlSurfaces/cellSizeFunction
|
||||||
$(cellSiseFunctions)/cellSizeFunction/cellSizeFunction.C
|
$(cellSizeFunctions)/cellSizeFunction/cellSizeFunction.C
|
||||||
$(cellSiseFunctions)/uniform/uniform.C
|
$(cellSizeFunctions)/uniform/uniform.C
|
||||||
$(cellSiseFunctions)/uniformDistance/uniformDistance.C
|
$(cellSizeFunctions)/uniformDistance/uniformDistance.C
|
||||||
$(cellSiseFunctions)/linearDistance/linearDistance.C
|
$(cellSizeFunctions)/linearDistance/linearDistance.C
|
||||||
$(cellSiseFunctions)/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C
|
$(cellSizeFunctions)/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C
|
||||||
$(cellSiseFunctions)/linearSpatial/linearSpatial.C
|
$(cellSizeFunctions)/linearSpatial/linearSpatial.C
|
||||||
|
|
||||||
|
surfaceCellSizeFunctions = cellSizeControlSurfaces/surfaceCellSizeFunction
|
||||||
|
$(surfaceCellSizeFunctions)/surfaceCellSizeFunction/surfaceCellSizeFunction.C
|
||||||
|
$(surfaceCellSizeFunctions)/uniformValue/uniformValue.C
|
||||||
|
$(surfaceCellSizeFunctions)/nonUniformField/nonUniformField.C
|
||||||
|
|
||||||
|
cellSizeCalculationType = $(surfaceCellSizeFunctions)/cellSizeCalculationType
|
||||||
|
$(cellSizeCalculationType)/cellSizeCalculationType/cellSizeCalculationType.C
|
||||||
|
$(cellSizeCalculationType)/fieldFromFile/fieldFromFile.C
|
||||||
|
$(cellSizeCalculationType)/automatic/automatic.C
|
||||||
|
|
||||||
initialPointsMethod/initialPointsMethod/initialPointsMethod.C
|
initialPointsMethod/initialPointsMethod/initialPointsMethod.C
|
||||||
initialPointsMethod/uniformGrid/uniformGrid.C
|
initialPointsMethod/uniformGrid/uniformGrid.C
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -337,5 +337,21 @@ Foam::scalarField Foam::cellSizeControlSurfaces::cellSize
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cellSizeControlSurfaces::setCellSizes
|
||||||
|
(
|
||||||
|
const pointField& pts
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (cellSizeFunctions_.size())
|
||||||
|
{
|
||||||
|
forAll(cellSizeFunctions_, i)
|
||||||
|
{
|
||||||
|
cellSizeFunction& cSF = cellSizeFunctions_[i];
|
||||||
|
|
||||||
|
cSF.setCellSize(pts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -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-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -133,6 +133,11 @@ public:
|
|||||||
|
|
||||||
//- Return the cell size at the given locations
|
//- Return the cell size at the given locations
|
||||||
scalarField cellSize(const pointField& pts) const;
|
scalarField cellSize(const pointField& pts) const;
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
//- Set the cell sizes for each point
|
||||||
|
void setCellSizes(const pointField& pts);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,18 +30,15 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
defineTypeNameAndDebug(cellSizeFunction, 0);
|
defineTypeNameAndDebug(cellSizeFunction, 0);
|
||||||
defineRunTimeSelectionTable(cellSizeFunction, dictionary);
|
defineRunTimeSelectionTable(cellSizeFunction, dictionary);
|
||||||
|
|
||||||
scalar cellSizeFunction::snapToSurfaceTol_ = 1e-10;
|
scalar cellSizeFunction::snapToSurfaceTol_ = 1e-10;
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
cellSizeFunction::cellSizeFunction
|
Foam::cellSizeFunction::cellSizeFunction
|
||||||
(
|
(
|
||||||
const word& type,
|
const word& type,
|
||||||
const dictionary& cellSizeFunctionDict,
|
const dictionary& cellSizeFunctionDict,
|
||||||
@ -50,6 +47,14 @@ cellSizeFunction::cellSizeFunction
|
|||||||
:
|
:
|
||||||
dictionary(cellSizeFunctionDict),
|
dictionary(cellSizeFunctionDict),
|
||||||
surface_(surface),
|
surface_(surface),
|
||||||
|
surfaceCellSizeFunction_
|
||||||
|
(
|
||||||
|
surfaceCellSizeFunction::New
|
||||||
|
(
|
||||||
|
cellSizeFunctionDict,
|
||||||
|
surface
|
||||||
|
)
|
||||||
|
),
|
||||||
coeffsDict_(subDict(type + "Coeffs")),
|
coeffsDict_(subDict(type + "Coeffs")),
|
||||||
sideMode_(),
|
sideMode_(),
|
||||||
priority_(readLabel(cellSizeFunctionDict.lookup("priority")))
|
priority_(readLabel(cellSizeFunctionDict.lookup("priority")))
|
||||||
@ -94,7 +99,7 @@ cellSizeFunction::cellSizeFunction
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
autoPtr<cellSizeFunction> cellSizeFunction::New
|
Foam::autoPtr<Foam::cellSizeFunction> Foam::cellSizeFunction::New
|
||||||
(
|
(
|
||||||
const dictionary& cellSizeFunctionDict,
|
const dictionary& cellSizeFunctionDict,
|
||||||
const searchableSurface& surface
|
const searchableSurface& surface
|
||||||
@ -134,12 +139,8 @@ autoPtr<cellSizeFunction> cellSizeFunction::New
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
cellSizeFunction::~cellSizeFunction()
|
Foam::cellSizeFunction::~cellSizeFunction()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -41,6 +41,7 @@ SourceFiles
|
|||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "surfaceCellSizeFunction.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -85,6 +86,11 @@ protected:
|
|||||||
// relates to
|
// relates to
|
||||||
const searchableSurface& surface_;
|
const searchableSurface& surface_;
|
||||||
|
|
||||||
|
//- Cell size at the surface
|
||||||
|
scalarField surfaceCellSize_;
|
||||||
|
|
||||||
|
autoPtr<surfaceCellSizeFunction> surfaceCellSizeFunction_;
|
||||||
|
|
||||||
//- Method details dictionary
|
//- Method details dictionary
|
||||||
dictionary coeffsDict_;
|
dictionary coeffsDict_;
|
||||||
|
|
||||||
@ -170,6 +176,18 @@ public:
|
|||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size
|
scalar& size
|
||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
virtual bool setCellSize
|
||||||
|
(
|
||||||
|
const pointField& pts
|
||||||
|
)
|
||||||
|
{
|
||||||
|
WarningIn("cellSizeFunction::setCellSize(const pointField&)")
|
||||||
|
<< "Not overloaded."
|
||||||
|
<< endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,8 @@ License
|
|||||||
|
|
||||||
#include "linearDistance.H"
|
#include "linearDistance.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "triSurfaceMesh.H"
|
||||||
|
#include "triSurfaceFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -46,29 +48,37 @@ linearDistance::linearDistance
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||||
surfaceCellSize_(readScalar(coeffsDict().lookup("surfaceCellSize"))),
|
|
||||||
distanceCellSize_(readScalar(coeffsDict().lookup("distanceCellSize"))),
|
distanceCellSize_(readScalar(coeffsDict().lookup("distanceCellSize"))),
|
||||||
distance_(readScalar(coeffsDict().lookup("distance"))),
|
distance_(readScalar(coeffsDict().lookup("distance"))),
|
||||||
distanceSqr_(sqr(distance_)),
|
distanceSqr_(sqr(distance_))
|
||||||
gradient_((distanceCellSize_ - surfaceCellSize_)/distance_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
scalar linearDistance::sizeFunction(scalar d) const
|
scalar linearDistance::sizeFunction
|
||||||
|
(
|
||||||
|
const point& pt,
|
||||||
|
scalar d,
|
||||||
|
label index
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return gradient_*d + surfaceCellSize_;
|
const scalar interpolatedSize
|
||||||
|
= surfaceCellSizeFunction_().interpolate(pt, index);
|
||||||
|
|
||||||
|
scalar gradient
|
||||||
|
= (distanceCellSize_ - interpolatedSize)
|
||||||
|
/distance_;
|
||||||
|
|
||||||
|
scalar size = gradient*d + interpolatedSize;
|
||||||
|
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool linearDistance::cellSize
|
bool linearDistance::cellSize(const point& pt, scalar& size) const
|
||||||
(
|
|
||||||
const point& pt,
|
|
||||||
scalar& size
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
@ -85,18 +95,23 @@ bool linearDistance::cellSize
|
|||||||
|
|
||||||
if (hitInfo.hit())
|
if (hitInfo.hit())
|
||||||
{
|
{
|
||||||
|
const point& hitPt = hitInfo.hitPoint();
|
||||||
|
const label hitIndex = hitInfo.index();
|
||||||
|
|
||||||
|
const scalar dist = mag(pt - hitPt);
|
||||||
|
|
||||||
if (sideMode_ == rmBothsides)
|
if (sideMode_ == rmBothsides)
|
||||||
{
|
{
|
||||||
size = sizeFunction(mag(pt - hitInfo.hitPoint()));
|
size = sizeFunction(hitPt, dist, hitIndex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the nearest point is essentially on the surface, do not do a
|
// If the nearest point is essentially on the surface, do not do a
|
||||||
// getVolumeType calculation, as it will be prone to error.
|
// getVolumeType calculation, as it will be prone to error.
|
||||||
if (mag(pt - hitInfo.hitPoint()) < snapToSurfaceTol_)
|
if (dist < snapToSurfaceTol_)
|
||||||
{
|
{
|
||||||
size = sizeFunction(0);
|
size = sizeFunction(hitPt, 0, hitIndex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -114,7 +129,7 @@ bool linearDistance::cellSize
|
|||||||
&& vTL[0] == searchableSurface::INSIDE
|
&& vTL[0] == searchableSurface::INSIDE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
size = sizeFunction(mag(pt - hitInfo.hitPoint()));
|
size = sizeFunction(hitPt, dist, hitIndex);
|
||||||
|
|
||||||
functionApplied = true;
|
functionApplied = true;
|
||||||
}
|
}
|
||||||
@ -124,7 +139,7 @@ bool linearDistance::cellSize
|
|||||||
&& vTL[0] == searchableSurface::OUTSIDE
|
&& vTL[0] == searchableSurface::OUTSIDE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
size = sizeFunction(mag(pt - hitInfo.hitPoint()));
|
size = sizeFunction(hitPt, dist, hitIndex);
|
||||||
|
|
||||||
functionApplied = true;
|
functionApplied = true;
|
||||||
}
|
}
|
||||||
@ -136,6 +151,48 @@ bool linearDistance::cellSize
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool linearDistance::setCellSize(const pointField& pts)
|
||||||
|
{
|
||||||
|
labelHashSet surfaceAlreadyHit(surfaceCellSize_.size());
|
||||||
|
|
||||||
|
forAll(pts, ptI)
|
||||||
|
{
|
||||||
|
const Foam::point& pt = pts[ptI];
|
||||||
|
|
||||||
|
List<pointIndexHit> hits;
|
||||||
|
|
||||||
|
surface_.findNearest
|
||||||
|
(
|
||||||
|
pointField(1, pt),
|
||||||
|
scalarField(1, distanceSqr_),
|
||||||
|
hits
|
||||||
|
);
|
||||||
|
|
||||||
|
const label surfHitI = hits[0].index();
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
hits[0].hit()
|
||||||
|
&& !surfaceAlreadyHit.found(surfHitI)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Halving cell size is arbitrary
|
||||||
|
surfaceCellSizeFunction_().refineSurfaceSize(surfHitI);
|
||||||
|
|
||||||
|
surfaceAlreadyHit.insert(surfHitI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force recalculation of the interpolation
|
||||||
|
if (!pts.empty())
|
||||||
|
{
|
||||||
|
surfaceCellSizeFunction_().recalculateInterpolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -54,9 +54,6 @@ private:
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- cell size at the surface
|
|
||||||
scalar surfaceCellSize_;
|
|
||||||
|
|
||||||
//- cell size at distance_ from the surface
|
//- cell size at distance_ from the surface
|
||||||
scalar distanceCellSize_;
|
scalar distanceCellSize_;
|
||||||
|
|
||||||
@ -66,14 +63,11 @@ private:
|
|||||||
//- distance squared
|
//- distance squared
|
||||||
scalar distanceSqr_;
|
scalar distanceSqr_;
|
||||||
|
|
||||||
//- storing gradient for linear function
|
|
||||||
scalar gradient_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Calculate the cell size as a function of the given distance
|
//- Calculate the cell size as a function of the given distance
|
||||||
scalar sizeFunction(scalar d) const;
|
scalar sizeFunction(const point& pt, scalar d, label index) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -107,6 +101,12 @@ public:
|
|||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size
|
scalar& size
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Adapt local cell size. Return true if anything changed.
|
||||||
|
virtual bool setCellSize
|
||||||
|
(
|
||||||
|
const pointField& pts
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -50,13 +50,10 @@ surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||||
surfaceCellSize_(readScalar(coeffsDict().lookup("surfaceCellSize"))),
|
|
||||||
distanceCellSize_(readScalar(coeffsDict().lookup("distanceCellSize"))),
|
distanceCellSize_(readScalar(coeffsDict().lookup("distanceCellSize"))),
|
||||||
surfaceOffset_(readScalar(coeffsDict().lookup("surfaceOffset"))),
|
surfaceOffset_(readScalar(coeffsDict().lookup("surfaceOffset"))),
|
||||||
totalDistance_(),
|
totalDistance_(),
|
||||||
totalDistanceSqr_(),
|
totalDistanceSqr_()
|
||||||
gradient_(),
|
|
||||||
intercept_()
|
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -111,25 +108,33 @@ surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
|
|||||||
}
|
}
|
||||||
|
|
||||||
totalDistanceSqr_ = sqr(totalDistance_);
|
totalDistanceSqr_ = sqr(totalDistance_);
|
||||||
|
|
||||||
gradient_ =
|
|
||||||
(distanceCellSize_ - surfaceCellSize_)
|
|
||||||
/(totalDistance_ - surfaceOffset_);
|
|
||||||
|
|
||||||
intercept_ = surfaceCellSize_ - gradient_*surfaceOffset_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
scalar surfaceOffsetLinearDistance::sizeFunction(scalar d) const
|
scalar surfaceOffsetLinearDistance::sizeFunction
|
||||||
|
(
|
||||||
|
const point& pt,
|
||||||
|
scalar d,
|
||||||
|
label index
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
|
const scalar interpolatedSize
|
||||||
|
= surfaceCellSizeFunction_().interpolate(pt, index);
|
||||||
|
|
||||||
if (d <= surfaceOffset_)
|
if (d <= surfaceOffset_)
|
||||||
{
|
{
|
||||||
return surfaceCellSize_;
|
return interpolatedSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return gradient_*d + intercept_;
|
scalar gradient =
|
||||||
|
(distanceCellSize_ - interpolatedSize)
|
||||||
|
/(totalDistance_ - surfaceOffset_);
|
||||||
|
|
||||||
|
scalar intercept = interpolatedSize - gradient*surfaceOffset_;
|
||||||
|
|
||||||
|
return gradient*d + intercept;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -156,9 +161,14 @@ bool surfaceOffsetLinearDistance::cellSize
|
|||||||
|
|
||||||
if (hitInfo.hit())
|
if (hitInfo.hit())
|
||||||
{
|
{
|
||||||
|
const point& hitPt = hitInfo.hitPoint();
|
||||||
|
const label hitIndex = hitInfo.index();
|
||||||
|
|
||||||
|
const scalar dist = mag(pt - hitPt);
|
||||||
|
|
||||||
if (sideMode_ == rmBothsides)
|
if (sideMode_ == rmBothsides)
|
||||||
{
|
{
|
||||||
size = sizeFunction(mag(pt - hitInfo.hitPoint()));
|
size = sizeFunction(hitPt, dist, hitIndex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -167,7 +177,7 @@ bool surfaceOffsetLinearDistance::cellSize
|
|||||||
// getVolumeType calculation, as it will be prone to error.
|
// getVolumeType calculation, as it will be prone to error.
|
||||||
if (mag(pt - hitInfo.hitPoint()) < snapToSurfaceTol_)
|
if (mag(pt - hitInfo.hitPoint()) < snapToSurfaceTol_)
|
||||||
{
|
{
|
||||||
size = sizeFunction(0);
|
size = sizeFunction(hitPt, 0, hitIndex);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -185,7 +195,7 @@ bool surfaceOffsetLinearDistance::cellSize
|
|||||||
&& vTL[0] == searchableSurface::INSIDE
|
&& vTL[0] == searchableSurface::INSIDE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
size = sizeFunction(mag(pt - hitInfo.hitPoint()));
|
size = sizeFunction(hitPt, dist, hitIndex);
|
||||||
|
|
||||||
functionApplied = true;
|
functionApplied = true;
|
||||||
}
|
}
|
||||||
@ -195,7 +205,7 @@ bool surfaceOffsetLinearDistance::cellSize
|
|||||||
&& vTL[0] == searchableSurface::OUTSIDE
|
&& vTL[0] == searchableSurface::OUTSIDE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
size = sizeFunction(mag(pt - hitInfo.hitPoint()));
|
size = sizeFunction(hitPt, dist, hitIndex);
|
||||||
|
|
||||||
functionApplied = true;
|
functionApplied = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -54,9 +54,6 @@ private:
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- cell size at the surface
|
|
||||||
scalar surfaceCellSize_;
|
|
||||||
|
|
||||||
//- cell size at distance_ from the surface
|
//- cell size at distance_ from the surface
|
||||||
scalar distanceCellSize_;
|
scalar distanceCellSize_;
|
||||||
|
|
||||||
@ -70,17 +67,11 @@ private:
|
|||||||
//- totalDistance squared
|
//- totalDistance squared
|
||||||
scalar totalDistanceSqr_;
|
scalar totalDistanceSqr_;
|
||||||
|
|
||||||
//- storing gradient for linear function
|
|
||||||
scalar gradient_;
|
|
||||||
|
|
||||||
//- storing intercept for linear function
|
|
||||||
scalar intercept_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Calculate the cell size as a function of the given distance
|
//- Calculate the cell size as a function of the given distance
|
||||||
scalar sizeFunction(scalar d) const;
|
scalar sizeFunction(const point& pt, scalar d, label index) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -44,8 +44,7 @@ uniform::uniform
|
|||||||
const searchableSurface& surface
|
const searchableSurface& surface
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
cellSizeFunction(typeName, initialPointsDict, surface)
|
||||||
cellSize_(readScalar(coeffsDict().lookup("cellSize")))
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -57,31 +56,47 @@ bool uniform::cellSize
|
|||||||
scalar& size
|
scalar& size
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
List<pointIndexHit> hits;
|
||||||
|
|
||||||
|
surface_.findNearest
|
||||||
|
(
|
||||||
|
pointField(1, pt),
|
||||||
|
scalarField(1, sqr(GREAT)),
|
||||||
|
hits
|
||||||
|
);
|
||||||
|
|
||||||
|
const pointIndexHit& hitInfo = hits[0];
|
||||||
|
|
||||||
|
if (hitInfo.hit())
|
||||||
|
{
|
||||||
|
const point& hitPt = hitInfo.hitPoint();
|
||||||
|
const label index = hitInfo.index();
|
||||||
|
|
||||||
if (sideMode_ == rmBothsides)
|
if (sideMode_ == rmBothsides)
|
||||||
{
|
{
|
||||||
size = cellSize_;
|
size = surfaceCellSizeFunction_().interpolate(hitPt, index);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
List<pointIndexHit> hits;
|
List<pointIndexHit> closeToSurfaceHits;
|
||||||
|
|
||||||
surface_.findNearest
|
surface_.findNearest
|
||||||
(
|
(
|
||||||
pointField(1, pt),
|
pointField(1, pt),
|
||||||
scalarField(1, sqr(snapToSurfaceTol_)),
|
scalarField(1, sqr(snapToSurfaceTol_)),
|
||||||
hits
|
closeToSurfaceHits
|
||||||
);
|
);
|
||||||
|
|
||||||
const pointIndexHit& hitInfo = hits[0];
|
const pointIndexHit& closeToSurface = closeToSurfaceHits[0];
|
||||||
|
|
||||||
// If the nearest point is essentially on the surface, do not do a
|
// If the nearest point is essentially on the surface, do not do a
|
||||||
// getVolumeType calculation, as it will be prone to error.
|
// getVolumeType calculation, as it will be prone to error.
|
||||||
if (hitInfo.hit())
|
if (closeToSurface.hit())
|
||||||
{
|
{
|
||||||
size = cellSize_;
|
size = surfaceCellSizeFunction_().interpolate(hitPt, index);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -99,7 +114,7 @@ bool uniform::cellSize
|
|||||||
&& vTL[0] == searchableSurface::INSIDE
|
&& vTL[0] == searchableSurface::INSIDE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
size = cellSize_;
|
size = surfaceCellSizeFunction_().interpolate(hitPt, index);
|
||||||
|
|
||||||
functionApplied = true;
|
functionApplied = true;
|
||||||
}
|
}
|
||||||
@ -109,7 +124,7 @@ bool uniform::cellSize
|
|||||||
&& vTL[0] == searchableSurface::OUTSIDE
|
&& vTL[0] == searchableSurface::OUTSIDE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
size = cellSize_;
|
size = surfaceCellSizeFunction_().interpolate(hitPt, index);
|
||||||
|
|
||||||
functionApplied = true;
|
functionApplied = true;
|
||||||
}
|
}
|
||||||
@ -117,6 +132,41 @@ bool uniform::cellSize
|
|||||||
return functionApplied;
|
return functionApplied;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool uniform::setCellSize
|
||||||
|
(
|
||||||
|
const pointField& pts
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// labelHashSet surfaceAlreadyHit(cellSize_.size());
|
||||||
|
//
|
||||||
|
// forAll(pts, ptI)
|
||||||
|
// {
|
||||||
|
// const Foam::point& pt = pts[ptI];
|
||||||
|
//
|
||||||
|
// List<pointIndexHit> hits;
|
||||||
|
//
|
||||||
|
// surface_.findNearest
|
||||||
|
// (
|
||||||
|
// pointField(1, pt),
|
||||||
|
// scalarField(1, sqr(GREAT)),
|
||||||
|
// hits
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// if (hits[0].hit() && !surfaceAlreadyHit.found(hits[0].index()))
|
||||||
|
// {
|
||||||
|
// surfaceCellSizeFunction_().refineCellSize(hits[0].index());
|
||||||
|
//
|
||||||
|
// surfaceAlreadyHit.insert(hits[0].index());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -54,9 +54,6 @@ private:
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Cell size
|
|
||||||
scalar cellSize_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -89,6 +86,12 @@ public:
|
|||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size
|
scalar& size
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Adapt local cell size. Return true if anything changed.
|
||||||
|
virtual bool setCellSize
|
||||||
|
(
|
||||||
|
const pointField& pts
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "uniformDistance.H"
|
#include "uniformDistance.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "dimensionSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -45,7 +46,6 @@ uniformDistance::uniformDistance
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
cellSizeFunction(typeName, initialPointsDict, surface),
|
cellSizeFunction(typeName, initialPointsDict, surface),
|
||||||
cellSize_(readScalar(coeffsDict().lookup("cellSize"))),
|
|
||||||
distance_(readScalar(coeffsDict().lookup("distance"))),
|
distance_(readScalar(coeffsDict().lookup("distance"))),
|
||||||
distanceSqr_(sqr(distance_))
|
distanceSqr_(sqr(distance_))
|
||||||
{}
|
{}
|
||||||
@ -76,7 +76,7 @@ bool uniformDistance::cellSize
|
|||||||
{
|
{
|
||||||
if (sideMode_ == rmBothsides)
|
if (sideMode_ == rmBothsides)
|
||||||
{
|
{
|
||||||
size = cellSize_;
|
size = surfaceCellSizeFunction_().surfaceSize(hitInfo.index());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ bool uniformDistance::cellSize
|
|||||||
// getVolumeType calculation, as it will be prone to error.
|
// getVolumeType calculation, as it will be prone to error.
|
||||||
if (mag(pt - hitInfo.hitPoint()) < snapToSurfaceTol_)
|
if (mag(pt - hitInfo.hitPoint()) < snapToSurfaceTol_)
|
||||||
{
|
{
|
||||||
size = cellSize_;
|
size = surfaceCellSizeFunction_().surfaceSize(hitInfo.index());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ bool uniformDistance::cellSize
|
|||||||
&& vTL[0] == searchableSurface::INSIDE
|
&& vTL[0] == searchableSurface::INSIDE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
size = cellSize_;
|
size = surfaceCellSizeFunction_().surfaceSize(hitInfo.index());
|
||||||
|
|
||||||
functionApplied = true;
|
functionApplied = true;
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ bool uniformDistance::cellSize
|
|||||||
&& vTL[0] == searchableSurface::OUTSIDE
|
&& vTL[0] == searchableSurface::OUTSIDE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
size = cellSize_;
|
size = surfaceCellSizeFunction_().surfaceSize(hitInfo.index());
|
||||||
|
|
||||||
functionApplied = true;
|
functionApplied = true;
|
||||||
}
|
}
|
||||||
@ -125,6 +125,38 @@ bool uniformDistance::cellSize
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool uniformDistance::setCellSize
|
||||||
|
(
|
||||||
|
const pointField& pts
|
||||||
|
)
|
||||||
|
{
|
||||||
|
labelHashSet surfaceAlreadyHit(surface_.size());
|
||||||
|
|
||||||
|
forAll(pts, ptI)
|
||||||
|
{
|
||||||
|
const Foam::point& pt = pts[ptI];
|
||||||
|
|
||||||
|
List<pointIndexHit> hits;
|
||||||
|
|
||||||
|
surface_.findNearest
|
||||||
|
(
|
||||||
|
pointField(1, pt),
|
||||||
|
scalarField(1, distanceSqr_),
|
||||||
|
hits
|
||||||
|
);
|
||||||
|
|
||||||
|
if (hits[0].hit() && !surfaceAlreadyHit.found(hits[0].index()))
|
||||||
|
{
|
||||||
|
surfaceCellSizeFunction_().refineSurfaceSize(hits[0].index());
|
||||||
|
|
||||||
|
surfaceAlreadyHit.insert(hits[0].index());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -54,9 +54,6 @@ private:
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Cell size
|
|
||||||
scalar cellSize_;
|
|
||||||
|
|
||||||
//- Distance
|
//- Distance
|
||||||
scalar distance_;
|
scalar distance_;
|
||||||
|
|
||||||
@ -95,6 +92,12 @@ public:
|
|||||||
const point& pt,
|
const point& pt,
|
||||||
scalar& size
|
scalar& size
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Adapt local cell size. Return true if anything changed.
|
||||||
|
virtual bool setCellSize
|
||||||
|
(
|
||||||
|
const pointField& pts
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,213 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "automatic.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "triSurfaceMesh.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(automatic, 0);
|
||||||
|
addToRunTimeSelectionTable(cellSizeCalculationType, automatic, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::automatic::automatic
|
||||||
|
(
|
||||||
|
const dictionary& cellSizeCalcTypeDict,
|
||||||
|
const triSurfaceMesh& surface
|
||||||
|
)
|
||||||
|
:
|
||||||
|
cellSizeCalculationType(typeName, cellSizeCalcTypeDict, surface),
|
||||||
|
coeffsDict_(cellSizeCalcTypeDict.subDict(typeName + "Coeffs")),
|
||||||
|
surface_(surface),
|
||||||
|
surfaceName_(surface.searchableSurface::name()),
|
||||||
|
readCurvature_(Switch(coeffsDict_.lookup("curvature"))),
|
||||||
|
curvatureFile_(coeffsDict_.lookup("curvatureFile")),
|
||||||
|
readFeatureProximity_(Switch(coeffsDict_.lookup("featureProximity"))),
|
||||||
|
featureProximityFile_(coeffsDict_.lookup("featureProximityFile")),
|
||||||
|
readInternalCloseness_(Switch(coeffsDict_.lookup("internalCloseness"))),
|
||||||
|
internalClosenessFile_(coeffsDict_.lookup("internalClosenessFile")),
|
||||||
|
curvatureCellSizeFactor_
|
||||||
|
(
|
||||||
|
readScalar(coeffsDict_.lookup("curvatureCellSizeFactor"))
|
||||||
|
),
|
||||||
|
maximumCellSize_
|
||||||
|
(
|
||||||
|
readScalar(coeffsDict_.lookup("maximumCellSize"))
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::triSurfaceScalarField Foam::automatic::load()
|
||||||
|
{
|
||||||
|
Info<< indent << "Calculating cell size on surface: "
|
||||||
|
<< surfaceName_ << endl;
|
||||||
|
|
||||||
|
triSurfaceScalarField surfaceCellSize
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
surfaceName_ + ".cellSize",
|
||||||
|
surface_.searchableSurface::time().constant(),
|
||||||
|
"triSurface",
|
||||||
|
surface_.searchableSurface::time(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surface_,
|
||||||
|
dimLength,
|
||||||
|
scalarField(surface_.size(), maximumCellSize_)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (readCurvature_)
|
||||||
|
{
|
||||||
|
Info<< indent << "Reading curvature: " << curvatureFile_ << endl;
|
||||||
|
|
||||||
|
triSurfacePointScalarField curvature
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
curvatureFile_,
|
||||||
|
surface_.searchableSurface::time().constant(),
|
||||||
|
"triSurface",
|
||||||
|
surface_.searchableSurface::time(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surface_,
|
||||||
|
dimLength,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
const List<labelledTri>& localFaces = surface_.localFaces();
|
||||||
|
const labelList& meshPoints = surface_.meshPoints();
|
||||||
|
|
||||||
|
forAll(surfaceCellSize, fI)
|
||||||
|
{
|
||||||
|
const labelList& facePoints = localFaces[fI].triFaceFace();
|
||||||
|
|
||||||
|
scalar interpolatedCurvatureToFace = 0.0;
|
||||||
|
|
||||||
|
forAll(facePoints, fpI)
|
||||||
|
{
|
||||||
|
interpolatedCurvatureToFace
|
||||||
|
+= curvature[meshPoints[facePoints[fpI]]];
|
||||||
|
}
|
||||||
|
|
||||||
|
interpolatedCurvatureToFace /= facePoints.size();
|
||||||
|
|
||||||
|
surfaceCellSize[fI] =
|
||||||
|
min
|
||||||
|
(
|
||||||
|
1.0
|
||||||
|
/max
|
||||||
|
(
|
||||||
|
(1.0/curvatureCellSizeFactor_)
|
||||||
|
*interpolatedCurvatureToFace,
|
||||||
|
1.0/maximumCellSize_
|
||||||
|
),
|
||||||
|
surfaceCellSize[fI]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (readInternalCloseness_)
|
||||||
|
{
|
||||||
|
Info<< indent << "Reading internal closeness: "
|
||||||
|
<< internalClosenessFile_ << endl;
|
||||||
|
|
||||||
|
triSurfaceScalarField internalCloseness
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
internalClosenessFile_,
|
||||||
|
surface_.searchableSurface::time().constant(),
|
||||||
|
"triSurface",
|
||||||
|
surface_.searchableSurface::time(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surface_,
|
||||||
|
dimLength,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(surfaceCellSize, fI)
|
||||||
|
{
|
||||||
|
surfaceCellSize[fI] =
|
||||||
|
min
|
||||||
|
(
|
||||||
|
internalCloseness[fI],
|
||||||
|
surfaceCellSize[fI]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (readFeatureProximity_)
|
||||||
|
{
|
||||||
|
Info<< indent << "Reading feature proximity: "
|
||||||
|
<< featureProximityFile_ << endl;
|
||||||
|
|
||||||
|
triSurfaceScalarField featureProximity
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
featureProximityFile_,
|
||||||
|
surface_.searchableSurface::time().constant(),
|
||||||
|
"triSurface",
|
||||||
|
surface_.searchableSurface::time(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surface_,
|
||||||
|
dimLength,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(surfaceCellSize, fI)
|
||||||
|
{
|
||||||
|
surfaceCellSize[fI] =
|
||||||
|
min
|
||||||
|
(
|
||||||
|
featureProximity[fI],
|
||||||
|
surfaceCellSize[fI]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
surfaceCellSize.write();
|
||||||
|
|
||||||
|
return surfaceCellSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::automatic
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
automatic.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef automatic_H
|
||||||
|
#define automatic_H
|
||||||
|
|
||||||
|
#include "cellSizeCalculationType.H"
|
||||||
|
#include "triSurfaceFields.H"
|
||||||
|
#include "PrimitivePatchInterpolation.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class triSurfaceMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class automatic Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class automatic
|
||||||
|
:
|
||||||
|
public cellSizeCalculationType
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Dictionary of coefficients for automatic cell sizing
|
||||||
|
const dictionary& coeffsDict_;
|
||||||
|
|
||||||
|
//- Reference to the triSurfaceMesh
|
||||||
|
const triSurfaceMesh& surface_;
|
||||||
|
|
||||||
|
//- Name of the surface. Used to write the cell size field
|
||||||
|
const word surfaceName_;
|
||||||
|
|
||||||
|
const Switch readCurvature_;
|
||||||
|
const word curvatureFile_;
|
||||||
|
|
||||||
|
const Switch readFeatureProximity_;
|
||||||
|
const word featureProximityFile_;
|
||||||
|
|
||||||
|
const Switch readInternalCloseness_;
|
||||||
|
const word internalClosenessFile_;
|
||||||
|
|
||||||
|
//- The curvature values are multiplied by the inverse of this value to
|
||||||
|
// get the cell size
|
||||||
|
const scalar curvatureCellSizeFactor_;
|
||||||
|
|
||||||
|
//- The maximum allowable sell size
|
||||||
|
const scalar maximumCellSize_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("automatic");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
automatic
|
||||||
|
(
|
||||||
|
const dictionary& cellSizeCalcTypeDict,
|
||||||
|
const triSurfaceMesh& surface
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~automatic()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Load the cell size field
|
||||||
|
virtual triSurfaceScalarField load();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cellSizeCalculationType.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "triSurfaceMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(cellSizeCalculationType, 0);
|
||||||
|
defineRunTimeSelectionTable(cellSizeCalculationType, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::cellSizeCalculationType::cellSizeCalculationType
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const dictionary& cellSizeCalculationTypeDict,
|
||||||
|
const triSurfaceMesh& surface
|
||||||
|
)
|
||||||
|
:
|
||||||
|
cellSizeCalculationTypeDict_(cellSizeCalculationTypeDict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::cellSizeCalculationType> Foam::cellSizeCalculationType::New
|
||||||
|
(
|
||||||
|
const dictionary& cellSizeCalculationTypeDict,
|
||||||
|
const triSurfaceMesh& surface
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word cellSizeCalculationTypeTypeName
|
||||||
|
(
|
||||||
|
cellSizeCalculationTypeDict.lookup("cellSizeCalculationType")
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " Selecting cellSizeCalculationType "
|
||||||
|
<< cellSizeCalculationTypeTypeName << endl;
|
||||||
|
|
||||||
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(cellSizeCalculationTypeTypeName);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"cellSizeCalculationType::New(dictionary&, "
|
||||||
|
"const conformalVoronoiMesh&, const searchableSurface&)"
|
||||||
|
) << "Unknown cellSizeCalculationType type "
|
||||||
|
<< cellSizeCalculationTypeTypeName
|
||||||
|
<< endl << endl
|
||||||
|
<< "Valid cellSizeCalculationType types are :" << endl
|
||||||
|
<< dictionaryConstructorTablePtr_->toc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<cellSizeCalculationType>
|
||||||
|
(
|
||||||
|
cstrIter()(cellSizeCalculationTypeDict, surface)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::cellSizeCalculationType::~cellSizeCalculationType()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,134 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::cellSizeCalculationType
|
||||||
|
|
||||||
|
Description
|
||||||
|
Abstract base class for specifying target cell sizes
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cellSizeCalculationType.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cellSizeCalculationType_H
|
||||||
|
#define cellSizeCalculationType_H
|
||||||
|
|
||||||
|
#include "searchableSurface.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "triSurfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class triSurfaceMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cellSizeCalculationType Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cellSizeCalculationType
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
const dictionary& cellSizeCalculationTypeDict_;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
cellSizeCalculationType(const cellSizeCalculationType&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const cellSizeCalculationType&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("cellSizeCalculationType");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
cellSizeCalculationType,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const dictionary& cellSizeCalculationTypeDict,
|
||||||
|
const triSurfaceMesh& surface
|
||||||
|
),
|
||||||
|
(cellSizeCalculationTypeDict, surface)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
cellSizeCalculationType
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const dictionary& cellSizeCalculationTypeDict,
|
||||||
|
const triSurfaceMesh& surface
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected cellSizeCalculationType
|
||||||
|
static autoPtr<cellSizeCalculationType> New
|
||||||
|
(
|
||||||
|
const dictionary& cellSizeCalculationTypeDict,
|
||||||
|
const triSurfaceMesh& surface
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~cellSizeCalculationType();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Load the cell size
|
||||||
|
virtual triSurfaceScalarField load() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fieldFromFile.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "triSurfaceMesh.H"
|
||||||
|
#include "triSurfaceFields.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(fieldFromFile, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
cellSizeCalculationType,
|
||||||
|
fieldFromFile,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fieldFromFile::fieldFromFile
|
||||||
|
(
|
||||||
|
const dictionary& cellSizeCalcTypeDict,
|
||||||
|
const triSurfaceMesh& surface
|
||||||
|
)
|
||||||
|
:
|
||||||
|
cellSizeCalculationType(typeName, cellSizeCalcTypeDict, surface),
|
||||||
|
surface_(surface),
|
||||||
|
fileName_
|
||||||
|
(
|
||||||
|
cellSizeCalcTypeDict.subDict(typeName + "Coeffs").lookup("fieldFile")
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::triSurfaceScalarField Foam::fieldFromFile::load()
|
||||||
|
{
|
||||||
|
Info<< "Loading: " << fileName_ << endl;
|
||||||
|
|
||||||
|
triSurfaceScalarField surfaceCellSize
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
fileName_,
|
||||||
|
surface_.searchableSurface::time().constant(),
|
||||||
|
"triSurface",
|
||||||
|
surface_.searchableSurface::time(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surface_,
|
||||||
|
dimLength,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
return surfaceCellSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fieldFromFile
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
fieldFromFile.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fieldFromFile_H
|
||||||
|
#define fieldFromFile_H
|
||||||
|
|
||||||
|
#include "cellSizeCalculationType.H"
|
||||||
|
#include "triSurfaceFields.H"
|
||||||
|
#include "PrimitivePatchInterpolation.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class triSurfaceMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class fieldFromFile Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class fieldFromFile
|
||||||
|
:
|
||||||
|
public cellSizeCalculationType
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to the triSurfaceMesh
|
||||||
|
const triSurfaceMesh& surface_;
|
||||||
|
|
||||||
|
//- Name of the triSurfaceScalarField file to load in. Must be in
|
||||||
|
// constant/triSurface
|
||||||
|
const word fileName_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("fieldFromFile");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
fieldFromFile
|
||||||
|
(
|
||||||
|
const dictionary& cellSizeCalcTypeDict,
|
||||||
|
const triSurfaceMesh& surface
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~fieldFromFile()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Load the cell size field
|
||||||
|
virtual triSurfaceScalarField load();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,167 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "nonUniformField.H"
|
||||||
|
#include "triSurfaceMesh.H"
|
||||||
|
#include "searchableSurface.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(nonUniformField, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
surfaceCellSizeFunction,
|
||||||
|
nonUniformField,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::nonUniformField::nonUniformField
|
||||||
|
(
|
||||||
|
const dictionary& cellSizeFunctionDict,
|
||||||
|
const searchableSurface& surface
|
||||||
|
)
|
||||||
|
:
|
||||||
|
surfaceCellSizeFunction(typeName, cellSizeFunctionDict, surface),
|
||||||
|
surfaceTriMesh_(refCast<const triSurfaceMesh>(surface)),
|
||||||
|
surfaceCellSize_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"surfaceCellSize.cellSize",
|
||||||
|
surface.time().constant(),
|
||||||
|
"triSurface",
|
||||||
|
surface.time(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surfaceTriMesh_,
|
||||||
|
dimLength,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
cellSizeCalculationType_
|
||||||
|
(
|
||||||
|
cellSizeCalculationType::New(coeffsDict(), surfaceTriMesh_)
|
||||||
|
),
|
||||||
|
pointCellSize_(),
|
||||||
|
patch_()
|
||||||
|
{
|
||||||
|
Info<< incrIndent << incrIndent;
|
||||||
|
|
||||||
|
surfaceCellSize_ = cellSizeCalculationType_().load();
|
||||||
|
|
||||||
|
Info<< decrIndent;
|
||||||
|
|
||||||
|
Info<< indent << "Cell size field statistics:" << nl
|
||||||
|
<< indent << " Minimum: " << min(surfaceCellSize_).value() << nl
|
||||||
|
<< indent << " Average: " << average(surfaceCellSize_).value() << nl
|
||||||
|
<< indent << " Maximum: " << max(surfaceCellSize_).value() << endl;
|
||||||
|
|
||||||
|
Info<< decrIndent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::scalar& Foam::nonUniformField::surfaceSize(const label index) const
|
||||||
|
{
|
||||||
|
return surfaceCellSize_[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::scalar& Foam::nonUniformField::refineSurfaceSize(const label index)
|
||||||
|
{
|
||||||
|
surfaceCellSize_[index] *= refinementFactor_;
|
||||||
|
|
||||||
|
return surfaceCellSize_[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::scalar Foam::nonUniformField::interpolate
|
||||||
|
(
|
||||||
|
const point& pt,
|
||||||
|
const label index
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (patch_.empty())
|
||||||
|
{
|
||||||
|
recalculateInterpolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
const face& faceHitByPt = surfaceTriMesh_.triSurface::operator[](index);
|
||||||
|
|
||||||
|
const pointField& pts = surfaceTriMesh_.points();
|
||||||
|
const Map<label>& pMap = surfaceTriMesh_.meshPointMap();
|
||||||
|
|
||||||
|
triPointRef tri
|
||||||
|
(
|
||||||
|
pts[faceHitByPt[0]],
|
||||||
|
pts[faceHitByPt[1]],
|
||||||
|
pts[faceHitByPt[2]]
|
||||||
|
);
|
||||||
|
|
||||||
|
scalarList bary(3, 0.0);
|
||||||
|
|
||||||
|
tri.barycentric(pt, bary);
|
||||||
|
|
||||||
|
return pointCellSize_()[pMap[faceHitByPt[0]]]*bary[0]
|
||||||
|
+ pointCellSize_()[pMap[faceHitByPt[1]]]*bary[1]
|
||||||
|
+ pointCellSize_()[pMap[faceHitByPt[2]]]*bary[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::nonUniformField::recalculateInterpolation() const
|
||||||
|
{
|
||||||
|
patch_.reset(new primitivePatchInterpolation(surfaceTriMesh_));
|
||||||
|
|
||||||
|
pointCellSize_.reset
|
||||||
|
(
|
||||||
|
new triSurfacePointScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"pointCellSize.cellSize",
|
||||||
|
surfaceTriMesh_.searchableSurface::time().constant(),
|
||||||
|
"triSurface",
|
||||||
|
surfaceTriMesh_.searchableSurface::time(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surfaceTriMesh_,
|
||||||
|
dimLength,
|
||||||
|
patch_().faceToPointInterpolate(surfaceCellSize_)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,123 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::nonUniformField
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
nonUniformField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef nonUniformField_H
|
||||||
|
#define nonUniformField_H
|
||||||
|
|
||||||
|
#include "triSurfaceFields.H"
|
||||||
|
#include "PrimitivePatchInterpolation.H"
|
||||||
|
#include "surfaceCellSizeFunction.H"
|
||||||
|
#include "cellSizeCalculationType.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class triSurfaceMesh;
|
||||||
|
class searchableSurface;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class nonUniformField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class nonUniformField
|
||||||
|
:
|
||||||
|
public surfaceCellSizeFunction
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Private typedef
|
||||||
|
|
||||||
|
typedef PrimitivePatchInterpolation
|
||||||
|
<
|
||||||
|
PrimitivePatch<labelledTri, List, pointField, point>
|
||||||
|
> primitivePatchInterpolation;
|
||||||
|
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
const triSurfaceMesh& surfaceTriMesh_;
|
||||||
|
|
||||||
|
triSurfaceScalarField surfaceCellSize_;
|
||||||
|
|
||||||
|
autoPtr<cellSizeCalculationType> cellSizeCalculationType_;
|
||||||
|
|
||||||
|
mutable autoPtr<triSurfacePointScalarField> pointCellSize_;
|
||||||
|
|
||||||
|
mutable autoPtr<primitivePatchInterpolation> patch_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("nonUniformField");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
nonUniformField
|
||||||
|
(
|
||||||
|
const dictionary& cellSizeFunctionDict,
|
||||||
|
const searchableSurface& surface
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~nonUniformField()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
virtual const scalar& surfaceSize(const label index) const;
|
||||||
|
|
||||||
|
virtual const scalar& refineSurfaceSize(const label index);
|
||||||
|
|
||||||
|
virtual scalar interpolate(const point& pt, const label index) const;
|
||||||
|
|
||||||
|
virtual void recalculateInterpolation() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "surfaceCellSizeFunction.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(surfaceCellSizeFunction, 0);
|
||||||
|
defineRunTimeSelectionTable(surfaceCellSizeFunction, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::surfaceCellSizeFunction::surfaceCellSizeFunction
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const dictionary& surfaceCellSizeFunctionDict,
|
||||||
|
const searchableSurface& surface
|
||||||
|
)
|
||||||
|
:
|
||||||
|
dictionary(surfaceCellSizeFunctionDict),
|
||||||
|
surface_(surface),
|
||||||
|
coeffsDict_(subDict(type + "Coeffs")),
|
||||||
|
refinementFactor_(readScalar(lookup("refinementFactor")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::surfaceCellSizeFunction> Foam::surfaceCellSizeFunction::New
|
||||||
|
(
|
||||||
|
const dictionary& surfaceCellSizeFunctionDict,
|
||||||
|
const searchableSurface& surface
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word surfaceCellSizeFunctionTypeName
|
||||||
|
(
|
||||||
|
surfaceCellSizeFunctionDict.lookup("surfaceCellSizeFunction")
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " Selecting surfaceCellSizeFunction "
|
||||||
|
<< surfaceCellSizeFunctionTypeName << endl;
|
||||||
|
|
||||||
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(surfaceCellSizeFunctionTypeName);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"surfaceCellSizeFunction::New(dictionary&, "
|
||||||
|
"const conformalVoronoiMesh&, const searchableSurface&)"
|
||||||
|
) << "Unknown surfaceCellSizeFunction type "
|
||||||
|
<< surfaceCellSizeFunctionTypeName
|
||||||
|
<< endl << endl
|
||||||
|
<< "Valid surfaceCellSizeFunction types are :" << endl
|
||||||
|
<< dictionaryConstructorTablePtr_->toc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<surfaceCellSizeFunction>
|
||||||
|
(
|
||||||
|
cstrIter()(surfaceCellSizeFunctionDict, surface)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::surfaceCellSizeFunction::~surfaceCellSizeFunction()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,159 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::surfaceCellSizeFunction
|
||||||
|
|
||||||
|
Description
|
||||||
|
Abstract base class for specifying target cell sizes
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
surfaceCellSizeFunction.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef surfaceCellSizeFunction_H
|
||||||
|
#define surfaceCellSizeFunction_H
|
||||||
|
|
||||||
|
#include "searchableSurface.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class surfaceCellSizeFunction Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class surfaceCellSizeFunction
|
||||||
|
:
|
||||||
|
public dictionary
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Reference to the searchableSurface that surfaceCellSizeFunction
|
||||||
|
// relates to
|
||||||
|
const searchableSurface& surface_;
|
||||||
|
|
||||||
|
const dictionary coeffsDict_;
|
||||||
|
|
||||||
|
//- If cell resizing is allowed, this is the factor of the old cell size
|
||||||
|
// to get the new cell size
|
||||||
|
scalar refinementFactor_;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
surfaceCellSizeFunction(const surfaceCellSizeFunction&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const surfaceCellSizeFunction&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("surfaceCellSizeFunction");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
surfaceCellSizeFunction,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const dictionary& surfaceCellSizeFunctionDict,
|
||||||
|
const searchableSurface& surface
|
||||||
|
),
|
||||||
|
(surfaceCellSizeFunctionDict, surface)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
surfaceCellSizeFunction
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const dictionary& surfaceCellSizeFunctionDict,
|
||||||
|
const searchableSurface& surface
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected surfaceCellSizeFunction
|
||||||
|
static autoPtr<surfaceCellSizeFunction> New
|
||||||
|
(
|
||||||
|
const dictionary& surfaceCellSizeFunctionDict,
|
||||||
|
const searchableSurface& surface
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~surfaceCellSizeFunction();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Const access to the details dictionary
|
||||||
|
inline const dictionary& coeffsDict() const
|
||||||
|
{
|
||||||
|
return coeffsDict_;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const scalar& surfaceSize(const label index) const = 0;
|
||||||
|
|
||||||
|
virtual const scalar& refineSurfaceSize(const label index) = 0;
|
||||||
|
|
||||||
|
virtual scalar interpolate
|
||||||
|
(
|
||||||
|
const point& pt,
|
||||||
|
const label index
|
||||||
|
) const = 0;
|
||||||
|
|
||||||
|
virtual void recalculateInterpolation() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "uniformValue.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(uniformValue, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
surfaceCellSizeFunction,
|
||||||
|
uniformValue,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::uniformValue::uniformValue
|
||||||
|
(
|
||||||
|
const dictionary& cellSizeFunctionDict,
|
||||||
|
const searchableSurface& surface
|
||||||
|
)
|
||||||
|
:
|
||||||
|
surfaceCellSizeFunction(typeName, cellSizeFunctionDict, surface),
|
||||||
|
surfaceCellSize_(readScalar(coeffsDict().lookup("surfaceCellSize")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::scalar& Foam::uniformValue::surfaceSize(const label index) const
|
||||||
|
{
|
||||||
|
return surfaceCellSize_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::scalar& Foam::uniformValue::refineSurfaceSize(const label index)
|
||||||
|
{
|
||||||
|
surfaceCellSize_ *= refinementFactor_;
|
||||||
|
|
||||||
|
return surfaceCellSize_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::scalar Foam::uniformValue::interpolate
|
||||||
|
(
|
||||||
|
const point& pt,
|
||||||
|
const label index
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return surfaceCellSize_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::uniformValue::recalculateInterpolation() const
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::uniformValue
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
uniformValue.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef uniformValue_H
|
||||||
|
#define uniformValue_H
|
||||||
|
|
||||||
|
#include "surfaceCellSizeFunction.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class uniformValue Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class uniformValue
|
||||||
|
:
|
||||||
|
public surfaceCellSizeFunction
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
scalar surfaceCellSize_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("uniformValue");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
uniformValue
|
||||||
|
(
|
||||||
|
const dictionary& cellSizeFunctionDict,
|
||||||
|
const searchableSurface& surface
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~uniformValue()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
virtual const scalar& surfaceSize(const label index) const;
|
||||||
|
|
||||||
|
virtual const scalar& refineSurfaceSize(const label index);
|
||||||
|
|
||||||
|
virtual scalar interpolate
|
||||||
|
(
|
||||||
|
const point& pt,
|
||||||
|
const label index
|
||||||
|
) const;
|
||||||
|
|
||||||
|
virtual void recalculateInterpolation() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -817,6 +817,8 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments
|
|||||||
|
|
||||||
label i = 0;
|
label i = 0;
|
||||||
|
|
||||||
|
checkCellSizing();
|
||||||
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
List<Point>::const_iterator pit = storePts.begin();
|
List<Point>::const_iterator pit = storePts.begin();
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -911,6 +911,17 @@ private:
|
|||||||
const HashSet<labelPair, labelPair::Hash<> >& deferredCollapseFaces
|
const HashSet<labelPair, labelPair::Hash<> >& deferredCollapseFaces
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Check whether the cell sizes are fine enough. Creates a polyMesh.
|
||||||
|
void checkCellSizing();
|
||||||
|
|
||||||
|
//- Find all cells with a patch face that is not near the surface. The
|
||||||
|
// allowed offset is the fraction of the target cell size.
|
||||||
|
labelHashSet findOffsetPatchFaces
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const scalar allowedOffset
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Create a polyMesh and check its quality, reports which
|
//- Create a polyMesh and check its quality, reports which
|
||||||
// elements damage the mesh quality, allowing backtracking.
|
// elements damage the mesh quality, allowing backtracking.
|
||||||
labelHashSet checkPolyMeshQuality(const pointField& pts) const;
|
labelHashSet checkPolyMeshQuality(const pointField& pts) const;
|
||||||
@ -1005,6 +1016,9 @@ private:
|
|||||||
const labelList& procNeighbours
|
const labelList& procNeighbours
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Create a polyMesh from points.
|
||||||
|
autoPtr<polyMesh> createPolyMeshFromPoints(const pointField& pts) const;
|
||||||
|
|
||||||
//- Rotate the faces on processor patches if necessary
|
//- Rotate the faces on processor patches if necessary
|
||||||
void reorderProcessorPatches
|
void reorderProcessorPatches
|
||||||
(
|
(
|
||||||
@ -1193,7 +1207,7 @@ public:
|
|||||||
|
|
||||||
//- Find the cellSet of the boundary cells which have points that
|
//- Find the cellSet of the boundary cells which have points that
|
||||||
// protrude out of the surface beyond a tolerance.
|
// protrude out of the surface beyond a tolerance.
|
||||||
void findRemainingProtrusionSet(const fvMesh& mesh) const;
|
labelHashSet findRemainingProtrusionSet(const polyMesh& mesh) const;
|
||||||
|
|
||||||
void writeProcessorInterface
|
void writeProcessorInterface
|
||||||
(
|
(
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "conformalVoronoiMesh.H"
|
#include "conformalVoronoiMesh.H"
|
||||||
#include "motionSmoother.H"
|
#include "motionSmoother.H"
|
||||||
#include "backgroundMeshDecomposition.H"
|
#include "backgroundMeshDecomposition.H"
|
||||||
|
#include "polyMeshGeometry.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -1552,7 +1553,8 @@ void Foam::conformalVoronoiMesh::deferredCollapseFaceSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
|
Foam::autoPtr<Foam::polyMesh>
|
||||||
|
Foam::conformalVoronoiMesh::createPolyMeshFromPoints
|
||||||
(
|
(
|
||||||
const pointField& pts
|
const pointField& pts
|
||||||
) const
|
) const
|
||||||
@ -1592,7 +1594,9 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
|
|||||||
labelList cellToDelaunayVertex(removeUnusedCells(owner, neighbour));
|
labelList cellToDelaunayVertex(removeUnusedCells(owner, neighbour));
|
||||||
cellCentres = pointField(cellCentres, cellToDelaunayVertex);
|
cellCentres = pointField(cellCentres, cellToDelaunayVertex);
|
||||||
|
|
||||||
polyMesh pMesh
|
autoPtr<polyMesh> meshPtr
|
||||||
|
(
|
||||||
|
new polyMesh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
@ -1606,8 +1610,11 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
|
|||||||
xferMove(faces),
|
xferMove(faces),
|
||||||
xferMove(owner),
|
xferMove(owner),
|
||||||
xferMove(neighbour)
|
xferMove(neighbour)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
polyMesh& pMesh = meshPtr();
|
||||||
|
|
||||||
List<polyPatch*> patches(patchStarts.size());
|
List<polyPatch*> patches(patchStarts.size());
|
||||||
|
|
||||||
label nValidPatches = 0;
|
label nValidPatches = 0;
|
||||||
@ -1672,6 +1679,199 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
|
|||||||
|
|
||||||
// pMesh.overrideCellCentres(cellCentres);
|
// pMesh.overrideCellCentres(cellCentres);
|
||||||
|
|
||||||
|
return meshPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::conformalVoronoiMesh::checkCellSizing()
|
||||||
|
{
|
||||||
|
Info<< "Checking cell sizes..."<< endl;
|
||||||
|
|
||||||
|
timeCheck("Start of Cell Sizing");
|
||||||
|
|
||||||
|
PackedBoolList boundaryPts(number_of_cells(), false);
|
||||||
|
pointField ptsField;
|
||||||
|
|
||||||
|
indexDualVertices(ptsField, boundaryPts);
|
||||||
|
|
||||||
|
// Merge close dual vertices.
|
||||||
|
mergeCloseDualVertices(ptsField, boundaryPts);
|
||||||
|
|
||||||
|
autoPtr<polyMesh> meshPtr = createPolyMeshFromPoints(ptsField);
|
||||||
|
const polyMesh& pMesh = meshPtr();
|
||||||
|
|
||||||
|
//pMesh.write();
|
||||||
|
|
||||||
|
// Find cells with poor quality
|
||||||
|
DynamicList<label> checkFaces(identity(pMesh.nFaces()));
|
||||||
|
labelHashSet wrongFaces(pMesh.nFaces()/100);
|
||||||
|
|
||||||
|
Info<< "Running checkMesh on mesh with " << pMesh.nCells()
|
||||||
|
<< " cells "<< endl;
|
||||||
|
|
||||||
|
const dictionary& dict
|
||||||
|
= cvMeshControls().cvMeshDict().subDict("meshQualityControls");
|
||||||
|
|
||||||
|
const scalar maxNonOrtho = readScalar(dict.lookup("maxNonOrtho", true));
|
||||||
|
|
||||||
|
label nWrongFaces = 0;
|
||||||
|
|
||||||
|
if (maxNonOrtho < 180.0 - SMALL)
|
||||||
|
{
|
||||||
|
polyMeshGeometry::checkFaceDotProduct
|
||||||
|
(
|
||||||
|
false,
|
||||||
|
maxNonOrtho,
|
||||||
|
pMesh,
|
||||||
|
pMesh.cellCentres(),
|
||||||
|
pMesh.faceAreas(),
|
||||||
|
checkFaces,
|
||||||
|
List<labelPair>(),
|
||||||
|
&wrongFaces
|
||||||
|
);
|
||||||
|
|
||||||
|
label nNonOrthogonal = returnReduce(wrongFaces.size(), sumOp<label>());
|
||||||
|
|
||||||
|
Info<< " non-orthogonality > " << maxNonOrtho
|
||||||
|
<< " degrees : " << nNonOrthogonal << endl;
|
||||||
|
|
||||||
|
nWrongFaces += nNonOrthogonal;
|
||||||
|
}
|
||||||
|
|
||||||
|
labelHashSet protrudingCells = findOffsetPatchFaces(pMesh, 0.25);
|
||||||
|
|
||||||
|
label nProtrudingCells = protrudingCells.size();
|
||||||
|
|
||||||
|
Info<< " protruding/intruding cells : " << nProtrudingCells << endl;
|
||||||
|
|
||||||
|
nWrongFaces += nProtrudingCells;
|
||||||
|
|
||||||
|
// motionSmoother::checkMesh
|
||||||
|
// (
|
||||||
|
// false,
|
||||||
|
// pMesh,
|
||||||
|
// cvMeshControls().cvMeshDict().subDict("meshQualityControls"),
|
||||||
|
// checkFaces,
|
||||||
|
// wrongFaces
|
||||||
|
// );
|
||||||
|
|
||||||
|
Info<< " Found total of " << nWrongFaces << " bad faces" << endl;
|
||||||
|
|
||||||
|
{
|
||||||
|
labelHashSet cellsToResizeMap(pMesh.nFaces()/100);
|
||||||
|
|
||||||
|
// Find cells that are attached to the faces in wrongFaces.
|
||||||
|
forAllConstIter(labelHashSet, wrongFaces, iter)
|
||||||
|
{
|
||||||
|
const label faceOwner = pMesh.faceOwner()[iter.key()];
|
||||||
|
const label faceNeighbour = pMesh.faceNeighbour()[iter.key()];
|
||||||
|
|
||||||
|
if (!cellsToResizeMap.found(faceOwner))
|
||||||
|
{
|
||||||
|
cellsToResizeMap.insert(faceOwner);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cellsToResizeMap.found(faceNeighbour))
|
||||||
|
{
|
||||||
|
cellsToResizeMap.insert(faceNeighbour);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cellsToResizeMap += protrudingCells;
|
||||||
|
|
||||||
|
pointField cellsToResize(cellsToResizeMap.size());
|
||||||
|
|
||||||
|
label count = 0;
|
||||||
|
for (label cellI = 0; cellI < pMesh.nCells(); ++cellI)
|
||||||
|
{
|
||||||
|
if (cellsToResizeMap.found(cellI))
|
||||||
|
{
|
||||||
|
cellsToResize[count++] = pMesh.cellCentres()[cellI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< " Automatically re-sizing " << cellsToResize.size()
|
||||||
|
<< " cells that are attached to the bad faces: DISABLED" << endl;
|
||||||
|
|
||||||
|
//cellSizeControl_.setCellSizes(cellsToResize);
|
||||||
|
}
|
||||||
|
|
||||||
|
timeCheck("End of Cell Sizing");
|
||||||
|
|
||||||
|
Info<< "Finished checking cell sizes"<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelHashSet Foam::conformalVoronoiMesh::findOffsetPatchFaces
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const scalar allowedOffset
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
timeCheck("Start findRemainingProtrusionSet");
|
||||||
|
|
||||||
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
cellSet offsetBoundaryCells
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
"cvMesh_protrudingCells",
|
||||||
|
mesh.nCells()/1000
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(patches, patchI)
|
||||||
|
{
|
||||||
|
const polyPatch& patch = patches[patchI];
|
||||||
|
|
||||||
|
const faceList& localFaces = patch.localFaces();
|
||||||
|
const pointField& localPoints = patch.localPoints();
|
||||||
|
|
||||||
|
const labelList& fCell = patch.faceCells();
|
||||||
|
|
||||||
|
forAll(localFaces, pLFI)
|
||||||
|
{
|
||||||
|
const face& f = localFaces[pLFI];
|
||||||
|
|
||||||
|
const Foam::point& faceCentre = f.centre(localPoints);
|
||||||
|
|
||||||
|
const scalar targetSize = targetCellSize(faceCentre);
|
||||||
|
|
||||||
|
pointIndexHit pHit;
|
||||||
|
label surfHit = -1;
|
||||||
|
|
||||||
|
geometryToConformTo_.findSurfaceNearest
|
||||||
|
(
|
||||||
|
faceCentre,
|
||||||
|
sqr(targetSize),
|
||||||
|
pHit,
|
||||||
|
surfHit
|
||||||
|
);
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
pHit.hit()
|
||||||
|
&& (mag(pHit.hitPoint() - faceCentre) > allowedOffset*targetSize)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
offsetBoundaryCells.insert(fCell[pLFI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
offsetBoundaryCells.write();
|
||||||
|
|
||||||
|
return offsetBoundaryCells;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
|
||||||
|
(
|
||||||
|
const pointField& pts
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
autoPtr<polyMesh> meshPtr = createPolyMeshFromPoints(pts);
|
||||||
|
polyMesh& pMesh = meshPtr();
|
||||||
|
|
||||||
timeCheck("polyMesh created, checking quality");
|
timeCheck("polyMesh created, checking quality");
|
||||||
|
|
||||||
labelHashSet wrongFaces(pMesh.nFaces()/100);
|
labelHashSet wrongFaces(pMesh.nFaces()/100);
|
||||||
@ -2264,10 +2464,6 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pout<< "Patch Names: " << patchNames << endl;
|
|
||||||
Pout<< "Patch Sizes: " << patchSizes << endl;
|
|
||||||
Pout<< "Proc Neighbours: " << procNeighbours << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -1072,9 +1072,9 @@ void Foam::conformalVoronoiMesh::writeCellCentres
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::conformalVoronoiMesh::findRemainingProtrusionSet
|
Foam::labelHashSet Foam::conformalVoronoiMesh::findRemainingProtrusionSet
|
||||||
(
|
(
|
||||||
const fvMesh& mesh
|
const polyMesh& mesh
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
timeCheck("Start findRemainingProtrusionSet");
|
timeCheck("Start findRemainingProtrusionSet");
|
||||||
@ -1129,7 +1129,7 @@ void Foam::conformalVoronoiMesh::findRemainingProtrusionSet
|
|||||||
|
|
||||||
reduce(protrudingCellsSize, sumOp<label>());
|
reduce(protrudingCellsSize, sumOp<label>());
|
||||||
|
|
||||||
if (protrudingCellsSize > 0)
|
if (cvMeshControls().objOutput() && protrudingCellsSize > 0)
|
||||||
{
|
{
|
||||||
Info<< nl << "Found " << protrudingCellsSize
|
Info<< nl << "Found " << protrudingCellsSize
|
||||||
<< " cells protruding from the surface, writing cellSet "
|
<< " cells protruding from the surface, writing cellSet "
|
||||||
@ -1138,6 +1138,8 @@ void Foam::conformalVoronoiMesh::findRemainingProtrusionSet
|
|||||||
|
|
||||||
protrudingCells.write();
|
protrudingCells.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return protrudingCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
33
applications/utilities/surface/surfaceFeatureExtract/Allwmake
Executable file
33
applications/utilities/surface/surfaceFeatureExtract/Allwmake
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # run from this directory
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if [ ! -e "Make/files" ] || [ ! -e "Make/options" ]
|
||||||
|
then
|
||||||
|
mkdir -p Make
|
||||||
|
|
||||||
|
if [ -n "$CGAL_ARCH_PATH" ]
|
||||||
|
then
|
||||||
|
cp -r MakeWithCGAL/* Make
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo Compiling surfaceFeatureExtract with CGAL support for curvature
|
||||||
|
echo
|
||||||
|
|
||||||
|
wmake
|
||||||
|
else
|
||||||
|
cp -r MakeWithoutCGAL/* Make
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo Compiling surfaceFeatureExtract without CGAL support for curvature
|
||||||
|
echo
|
||||||
|
|
||||||
|
wmake
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo surfaceFeatureExtract already has a Make folder
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------- end-of-file
|
||||||
@ -0,0 +1,228 @@
|
|||||||
|
#ifndef CGAL_PSURF_RINGS_H_
|
||||||
|
#define CGAL_PSURF_RINGS_H_
|
||||||
|
|
||||||
|
// This file adapted from
|
||||||
|
// CGAL-3.7/examples/Jet_fitting_3//PolyhedralSurf_rings.h
|
||||||
|
// Licensed under CGAL-3.7/LICENSE.FREE_USE
|
||||||
|
|
||||||
|
// Copyright (c) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
|
||||||
|
// Utrecht University (The Netherlands), ETH Zurich (Switzerland), Freie
|
||||||
|
// Universitaet Berlin (Germany), INRIA Sophia-Antipolis (France),
|
||||||
|
// Martin-Luther-University Halle-Wittenberg (Germany), Max-Planck-Institute
|
||||||
|
// Saarbruecken (Germany), RISC Linz (Austria), and Tel-Aviv University
|
||||||
|
// (Israel). All rights reserved.
|
||||||
|
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
template
|
||||||
|
<
|
||||||
|
class TPoly,
|
||||||
|
class VertexPropertyMap
|
||||||
|
>
|
||||||
|
|
||||||
|
class T_PolyhedralSurf_rings
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Polyhedron
|
||||||
|
typedef typename TPoly::Vertex Vertex;
|
||||||
|
typedef typename TPoly::Halfedge Halfedge;
|
||||||
|
typedef typename TPoly::Facet Facet;
|
||||||
|
typedef typename TPoly::Halfedge_around_vertex_circulator
|
||||||
|
Halfedge_around_vertex_circulator;
|
||||||
|
typedef typename TPoly::Vertex_iterator Vertex_iterator;
|
||||||
|
|
||||||
|
// vertex indices are initialised to -1
|
||||||
|
static void reset_ring_indices
|
||||||
|
(
|
||||||
|
std::vector< Vertex* >& vces,
|
||||||
|
VertexPropertyMap& vpm
|
||||||
|
);
|
||||||
|
|
||||||
|
// i >= 1; from a start vertex on the current i-1 ring, push non-visited
|
||||||
|
// neighbors of start in the nextRing and set indices to i. Also add these
|
||||||
|
// vertices in all.
|
||||||
|
static void push_neighbours_of
|
||||||
|
(
|
||||||
|
Vertex* start,
|
||||||
|
int ith,
|
||||||
|
std::vector< Vertex* >& nextRing,
|
||||||
|
std::vector< Vertex* >& all,
|
||||||
|
VertexPropertyMap& vpm
|
||||||
|
);
|
||||||
|
|
||||||
|
// i >= 1, from a currentRing i-1, collect all neighbors, set indices
|
||||||
|
// to i and store them in nextRing and all.
|
||||||
|
static void collect_ith_ring
|
||||||
|
(
|
||||||
|
int ith,
|
||||||
|
std::vector< Vertex* >& currentRing,
|
||||||
|
std::vector< Vertex* >& nextRing,
|
||||||
|
std::vector< Vertex* >& all,
|
||||||
|
VertexPropertyMap& vpm
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// collect i>=1 rings : all neighbours up to the ith ring,
|
||||||
|
static void collect_i_rings
|
||||||
|
(
|
||||||
|
Vertex* v,
|
||||||
|
int ring_i,
|
||||||
|
std::vector< Vertex* >& all,
|
||||||
|
VertexPropertyMap& vpm
|
||||||
|
);
|
||||||
|
|
||||||
|
//collect enough rings (at least 1), to get at least min_nb of neighbors
|
||||||
|
static void collect_enough_rings
|
||||||
|
(
|
||||||
|
Vertex* v,
|
||||||
|
unsigned int min_nb,
|
||||||
|
std::vector< Vertex* >& all,
|
||||||
|
VertexPropertyMap& vpm
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////IMPLEMENTATION////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template < class TPoly , class VertexPropertyMap>
|
||||||
|
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||||
|
push_neighbours_of(Vertex* start, int ith,
|
||||||
|
std::vector< Vertex* >& nextRing,
|
||||||
|
std::vector< Vertex* >& all,
|
||||||
|
VertexPropertyMap& vpm)
|
||||||
|
{
|
||||||
|
Vertex *v;
|
||||||
|
Halfedge_around_vertex_circulator
|
||||||
|
hedgeb = start->vertex_begin(), hedgee = hedgeb;
|
||||||
|
|
||||||
|
CGAL_For_all(hedgeb, hedgee)
|
||||||
|
{
|
||||||
|
v = &*(hedgeb->opposite()->vertex());
|
||||||
|
if (get(vpm, v) != -1) continue; //if visited: next
|
||||||
|
|
||||||
|
put(vpm, v, ith);
|
||||||
|
nextRing.push_back(v);
|
||||||
|
all.push_back(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class TPoly, class VertexPropertyMap>
|
||||||
|
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||||
|
collect_ith_ring(int ith, std::vector< Vertex* >& currentRing,
|
||||||
|
std::vector< Vertex* >& nextRing,
|
||||||
|
std::vector< Vertex* >& all,
|
||||||
|
VertexPropertyMap& vpm)
|
||||||
|
{
|
||||||
|
typename std::vector< Vertex* >::iterator
|
||||||
|
itb = currentRing.begin(), ite = currentRing.end();
|
||||||
|
|
||||||
|
CGAL_For_all(itb, ite)
|
||||||
|
{
|
||||||
|
push_neighbours_of(*itb, ith, nextRing, all, vpm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class TPoly, class VertexPropertyMap>
|
||||||
|
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||||
|
reset_ring_indices(std::vector< Vertex* >& vces,
|
||||||
|
VertexPropertyMap& vpm)
|
||||||
|
{
|
||||||
|
typename std::vector< Vertex* >::iterator
|
||||||
|
itb = vces.begin(), ite = vces.end();
|
||||||
|
|
||||||
|
CGAL_For_all(itb, ite)
|
||||||
|
{
|
||||||
|
put(vpm, *itb, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class TPoly, class VertexPropertyMap>
|
||||||
|
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||||
|
collect_i_rings(Vertex* v,
|
||||||
|
int ring_i,
|
||||||
|
std::vector< Vertex* >& all,
|
||||||
|
VertexPropertyMap& vpm)
|
||||||
|
{
|
||||||
|
std::vector<Vertex*> current_ring, next_ring;
|
||||||
|
std::vector<Vertex*> *p_current_ring, *p_next_ring;
|
||||||
|
assert(ring_i >= 1);
|
||||||
|
|
||||||
|
//initialize
|
||||||
|
p_current_ring = ¤t_ring;
|
||||||
|
p_next_ring = &next_ring;
|
||||||
|
put(vpm, v, 0);
|
||||||
|
current_ring.push_back(v);
|
||||||
|
all.push_back(v);
|
||||||
|
|
||||||
|
for (int i=1; i<=ring_i; i++)
|
||||||
|
{
|
||||||
|
collect_ith_ring(i, *p_current_ring, *p_next_ring, all, vpm);
|
||||||
|
//next round must be launched from p_nextRing...
|
||||||
|
p_current_ring->clear();
|
||||||
|
std::swap(p_current_ring, p_next_ring);
|
||||||
|
}
|
||||||
|
|
||||||
|
//clean up
|
||||||
|
reset_ring_indices(all, vpm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class TPoly, class VertexPropertyMap>
|
||||||
|
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||||
|
collect_enough_rings(Vertex* v,
|
||||||
|
unsigned int min_nb,
|
||||||
|
std::vector< Vertex* >& all,
|
||||||
|
VertexPropertyMap& vpm)
|
||||||
|
{
|
||||||
|
std::vector<Vertex*> current_ring, next_ring;
|
||||||
|
std::vector<Vertex*> *p_current_ring, *p_next_ring;
|
||||||
|
|
||||||
|
//initialize
|
||||||
|
p_current_ring = ¤t_ring;
|
||||||
|
p_next_ring = &next_ring;
|
||||||
|
put(vpm, v, 0);
|
||||||
|
current_ring.push_back(v);
|
||||||
|
all.push_back(v);
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
|
|
||||||
|
while ( (all.size() < min_nb) && (p_current_ring->size() != 0) )
|
||||||
|
{
|
||||||
|
collect_ith_ring(i, *p_current_ring, *p_next_ring, all, vpm);
|
||||||
|
//next round must be launched from p_nextRing...
|
||||||
|
p_current_ring->clear();
|
||||||
|
std::swap(p_current_ring, p_next_ring);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//clean up
|
||||||
|
reset_ring_indices(all, vpm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "buildCGALPolyhedron.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::buildCGALPolyhedron::buildCGALPolyhedron
|
||||||
|
(
|
||||||
|
const Foam::triSurface& surf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
CGAL::Modifier_base<HalfedgeDS>(),
|
||||||
|
surf_(surf)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::buildCGALPolyhedron::~buildCGALPolyhedron()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::buildCGALPolyhedron::operator()
|
||||||
|
(
|
||||||
|
HalfedgeDS& hds
|
||||||
|
)
|
||||||
|
{
|
||||||
|
typedef HalfedgeDS::Traits Traits;
|
||||||
|
typedef Traits::Point_3 Point;
|
||||||
|
|
||||||
|
// Postcondition: `hds' is a valid polyhedral surface.
|
||||||
|
CGAL::Polyhedron_incremental_builder_3<HalfedgeDS> B(hds, false);
|
||||||
|
|
||||||
|
B.begin_surface
|
||||||
|
(
|
||||||
|
surf_.points().size(), // n points
|
||||||
|
surf_.size(), // n facets
|
||||||
|
2*surf_.edges().size() // n halfedges
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(surf_.points(), pI)
|
||||||
|
{
|
||||||
|
const Foam::point& p = surf_.points()[pI];
|
||||||
|
|
||||||
|
B.add_vertex(Point(p.x(), p.y(), p.z()));
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(surf_, fI)
|
||||||
|
{
|
||||||
|
B.begin_facet();
|
||||||
|
|
||||||
|
B.add_vertex_to_facet(surf_[fI][0]);
|
||||||
|
B.add_vertex_to_facet(surf_[fI][1]);
|
||||||
|
B.add_vertex_to_facet(surf_[fI][2]);
|
||||||
|
|
||||||
|
B.end_facet();
|
||||||
|
}
|
||||||
|
|
||||||
|
B.end_surface();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::buildCGALPolyhedron
|
||||||
|
|
||||||
|
Description
|
||||||
|
Convert a triSurface into a CGAL Polyhedron
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
buildCGALPolyhedron.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef buildCGALPolyhedron_H
|
||||||
|
#define buildCGALPolyhedron_H
|
||||||
|
|
||||||
|
#include "triSurface.H"
|
||||||
|
#include <CGAL/Simple_cartesian.h>
|
||||||
|
#include <CGAL/Polyhedron_incremental_builder_3.h>
|
||||||
|
#include <CGAL/Polyhedron_3.h>
|
||||||
|
|
||||||
|
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||||
|
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||||
|
typedef Polyhedron::HalfedgeDS HalfedgeDS;
|
||||||
|
typedef Polyhedron::Vertex Vertex;
|
||||||
|
typedef Polyhedron::Vertex_iterator Vertex_iterator;
|
||||||
|
typedef Kernel::Point_3 Point_3;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class buildCGALPolyhedron Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class buildCGALPolyhedron
|
||||||
|
:
|
||||||
|
public CGAL::Modifier_base<HalfedgeDS>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to triSurface to convert
|
||||||
|
const Foam::triSurface& surf_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
buildCGALPolyhedron(const buildCGALPolyhedron&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const buildCGALPolyhedron&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with reference to triSurface
|
||||||
|
buildCGALPolyhedron(const triSurface& surf);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~buildCGALPolyhedron();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
//- operator() of this `modifier' called by delegate function of
|
||||||
|
// Polyhedron
|
||||||
|
void operator()(HalfedgeDS& hds);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
surfaceFeatureExtract.C
|
||||||
|
CGALPolyhedron/buildCGALPolyhedron.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/surfaceFeatureExtract
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
EXE_FROUNDING_MATH = -frounding-math
|
||||||
|
EXE_NDEBUG = -DNDEBUG
|
||||||
|
USE_F2C = -DCGAL_USE_F2C
|
||||||
|
include $(GENERAL_RULES)/CGAL
|
||||||
|
|
||||||
|
EXE_INC = \
|
||||||
|
-DENABLE_CURVATURE \
|
||||||
|
${EXE_FROUNDING_MATH} \
|
||||||
|
${EXE_NDEBUG} \
|
||||||
|
${USE_F2C} \
|
||||||
|
${CGAL_INC} \
|
||||||
|
-ICGALPolyhedron \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/sampling/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
$(CGAL_LIBS) \
|
||||||
|
-L$(CGAL_ARCH_PATH)/lib \
|
||||||
|
-llapack \
|
||||||
|
-lblas \
|
||||||
|
-lCGAL \
|
||||||
|
-lmeshTools \
|
||||||
|
-ledgeMesh \
|
||||||
|
-ltriSurface \
|
||||||
|
-lsampling
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
surfaceFeatureExtract.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/surfaceFeatureExtract
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/sampling/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lmeshTools \
|
||||||
|
-ledgeMesh \
|
||||||
|
-ltriSurface \
|
||||||
|
-lsampling
|
||||||
@ -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) 2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -46,10 +46,263 @@ Description
|
|||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
#include "plane.H"
|
#include "plane.H"
|
||||||
|
|
||||||
|
#ifdef ENABLE_CURVATURE
|
||||||
|
#include "buildCGALPolyhedron.H"
|
||||||
|
#include "CGALPolyhedronRings.H"
|
||||||
|
#include <CGAL/Monge_via_jet_fitting.h>
|
||||||
|
#include <CGAL/Lapack/Linear_algebra_lapack.h>
|
||||||
|
#include <CGAL/property_map.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef ENABLE_CURVATURE
|
||||||
|
scalarField calcCurvature(const triSurface& surf)
|
||||||
|
{
|
||||||
|
scalarField k(surf.points().size(), 0);
|
||||||
|
|
||||||
|
Polyhedron P;
|
||||||
|
|
||||||
|
buildCGALPolyhedron convert(surf);
|
||||||
|
P.delegate(convert);
|
||||||
|
|
||||||
|
// Info<< "Created CGAL Polyhedron with " << label(P.size_of_vertices())
|
||||||
|
// << " vertices and " << label(P.size_of_facets())
|
||||||
|
// << " facets. " << endl;
|
||||||
|
|
||||||
|
// The rest of this function adapted from
|
||||||
|
// CGAL-3.7/examples/Jet_fitting_3/Mesh_estimation.cpp
|
||||||
|
// Licensed under CGAL-3.7/LICENSE.FREE_USE
|
||||||
|
|
||||||
|
// Copyright (c) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
|
||||||
|
// Utrecht University (The Netherlands), ETH Zurich (Switzerland), Freie
|
||||||
|
// Universitaet Berlin (Germany), INRIA Sophia-Antipolis (France),
|
||||||
|
// Martin-Luther-University Halle-Wittenberg (Germany), Max-Planck-Institute
|
||||||
|
// Saarbruecken (Germany), RISC Linz (Austria), and Tel-Aviv University
|
||||||
|
// (Israel). All rights reserved.
|
||||||
|
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
// persons to whom the Software is furnished to do so, subject to the
|
||||||
|
// following conditions:
|
||||||
|
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
|
||||||
|
// OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||||
|
// THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
//Vertex property map, with std::map
|
||||||
|
typedef std::map<Vertex*, int> Vertex2int_map_type;
|
||||||
|
typedef boost::associative_property_map< Vertex2int_map_type >
|
||||||
|
Vertex_PM_type;
|
||||||
|
typedef T_PolyhedralSurf_rings<Polyhedron, Vertex_PM_type > Poly_rings;
|
||||||
|
|
||||||
|
typedef CGAL::Monge_via_jet_fitting<Kernel> Monge_via_jet_fitting;
|
||||||
|
typedef Monge_via_jet_fitting::Monge_form Monge_form;
|
||||||
|
|
||||||
|
std::vector<Point_3> in_points; //container for data points
|
||||||
|
|
||||||
|
// default parameter values and global variables
|
||||||
|
unsigned int d_fitting = 2;
|
||||||
|
unsigned int d_monge = 2;
|
||||||
|
unsigned int min_nb_points = (d_fitting + 1)*(d_fitting + 2)/2;
|
||||||
|
|
||||||
|
//initialize the tag of all vertices to -1
|
||||||
|
Vertex_iterator vitb = P.vertices_begin();
|
||||||
|
Vertex_iterator vite = P.vertices_end();
|
||||||
|
|
||||||
|
Vertex2int_map_type vertex2props;
|
||||||
|
Vertex_PM_type vpm(vertex2props);
|
||||||
|
|
||||||
|
CGAL_For_all(vitb, vite)
|
||||||
|
{
|
||||||
|
put(vpm, &(*vitb), -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
vite = P.vertices_end();
|
||||||
|
|
||||||
|
label vertI = 0;
|
||||||
|
|
||||||
|
for (vitb = P.vertices_begin(); vitb != vite; vitb++)
|
||||||
|
{
|
||||||
|
//initialize
|
||||||
|
Vertex* v = &(*vitb);
|
||||||
|
|
||||||
|
//gather points around the vertex using rings
|
||||||
|
// From: gather_fitting_points(v, in_points, vpm);
|
||||||
|
{
|
||||||
|
std::vector<Vertex*> gathered;
|
||||||
|
in_points.clear();
|
||||||
|
|
||||||
|
Poly_rings::collect_enough_rings(v, min_nb_points, gathered, vpm);
|
||||||
|
|
||||||
|
//store the gathered points
|
||||||
|
std::vector<Vertex*>::iterator itb = gathered.begin();
|
||||||
|
std::vector<Vertex*>::iterator ite = gathered.end();
|
||||||
|
|
||||||
|
CGAL_For_all(itb, ite)
|
||||||
|
{
|
||||||
|
in_points.push_back((*itb)->point());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//skip if the nb of points is to small
|
||||||
|
if ( in_points.size() < min_nb_points )
|
||||||
|
{
|
||||||
|
std::cerr
|
||||||
|
<< "not enough pts for fitting this vertex"
|
||||||
|
<< in_points.size()
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// perform the fitting
|
||||||
|
Monge_via_jet_fitting monge_fit;
|
||||||
|
|
||||||
|
Monge_form monge_form = monge_fit
|
||||||
|
(
|
||||||
|
in_points.begin(),
|
||||||
|
in_points.end(),
|
||||||
|
d_fitting,
|
||||||
|
d_monge
|
||||||
|
);
|
||||||
|
|
||||||
|
// std::cout<< monge_form;;
|
||||||
|
// std::cout<< "condition number : "
|
||||||
|
// << monge_fit.condition_number() << nl << std::endl;
|
||||||
|
|
||||||
|
// Use the maximum curvature to give smaller cell sizes later.
|
||||||
|
k[vertI++]
|
||||||
|
= max
|
||||||
|
(
|
||||||
|
mag(monge_form.principal_curvatures(0)),
|
||||||
|
mag(monge_form.principal_curvatures(1))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
bool edgesConnected(const edge& e1, const edge& e2)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
e1.start() == e2.start() || e1.start() == e2.end()
|
||||||
|
|| e1.end() == e2.start() || e1.end() == e2.end()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
scalar calcProximityOfFeaturePoints
|
||||||
|
(
|
||||||
|
const List<pointIndexHit>& hitList,
|
||||||
|
const scalar defaultCellSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
scalar minDist = defaultCellSize;
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
label hI1 = 0;
|
||||||
|
hI1 < hitList.size() - 1;
|
||||||
|
++hI1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const pointIndexHit& pHit1 = hitList[hI1];
|
||||||
|
|
||||||
|
if (pHit1.hit())
|
||||||
|
{
|
||||||
|
for
|
||||||
|
(
|
||||||
|
label hI2 = hI1 + 1;
|
||||||
|
hI2 < hitList.size();
|
||||||
|
++hI2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const pointIndexHit& pHit2 = hitList[hI2];
|
||||||
|
|
||||||
|
if (pHit2.hit())
|
||||||
|
{
|
||||||
|
scalar curDist = mag(pHit1.hitPoint() - pHit2.hitPoint());
|
||||||
|
|
||||||
|
minDist = min(curDist, minDist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return minDist;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
scalar calcProximityOfFeatureEdges
|
||||||
|
(
|
||||||
|
const extendedFeatureEdgeMesh& efem,
|
||||||
|
const List<pointIndexHit>& hitList,
|
||||||
|
const scalar defaultCellSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
scalar minDist = defaultCellSize;
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
label hI1 = 0;
|
||||||
|
hI1 < hitList.size() - 1;
|
||||||
|
++hI1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const pointIndexHit& pHit1 = hitList[hI1];
|
||||||
|
|
||||||
|
if (pHit1.hit())
|
||||||
|
{
|
||||||
|
const edge& e1 = efem.edges()[pHit1.index()];
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
label hI2 = hI1 + 1;
|
||||||
|
hI2 < hitList.size();
|
||||||
|
++hI2
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const pointIndexHit& pHit2 = hitList[hI2];
|
||||||
|
|
||||||
|
if (pHit2.hit())
|
||||||
|
{
|
||||||
|
const edge& e2 = efem.edges()[pHit2.index()];
|
||||||
|
|
||||||
|
// Don't refine if the edges are connected to each other
|
||||||
|
if (!edgesConnected(e1, e2))
|
||||||
|
{
|
||||||
|
scalar curDist
|
||||||
|
= mag(pHit1.hitPoint() - pHit2.hitPoint());
|
||||||
|
|
||||||
|
minDist = min(curDist, minDist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return minDist;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void dumpBox(const treeBoundBox& bb, const fileName& fName)
|
void dumpBox(const treeBoundBox& bb, const fileName& fName)
|
||||||
{
|
{
|
||||||
OFstream str(fName);
|
OFstream str(fName);
|
||||||
@ -299,10 +552,9 @@ int main(int argc, char *argv[])
|
|||||||
"writeVTK",
|
"writeVTK",
|
||||||
"write extendedFeatureEdgeMesh vtk files"
|
"write extendedFeatureEdgeMesh vtk files"
|
||||||
);
|
);
|
||||||
argList::addOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"closeness",
|
"closeness",
|
||||||
"scalar",
|
|
||||||
"span to look for surface closeness"
|
"span to look for surface closeness"
|
||||||
);
|
);
|
||||||
argList::addOption
|
argList::addOption
|
||||||
@ -331,7 +583,7 @@ int main(int argc, char *argv[])
|
|||||||
# ifdef ENABLE_CURVATURE
|
# ifdef ENABLE_CURVATURE
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"calcCurvature",
|
"curvature",
|
||||||
"calculate curvature and closeness fields"
|
"calculate curvature and closeness fields"
|
||||||
);
|
);
|
||||||
# endif
|
# endif
|
||||||
@ -527,6 +779,7 @@ int main(int argc, char *argv[])
|
|||||||
<< " will be included as feature edges."<< endl;
|
<< " will be included as feature edges."<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
surfaceFeatures newSet(surf);
|
surfaceFeatures newSet(surf);
|
||||||
newSet.setFromStatus(edgeStat);
|
newSet.setFromStatus(edgeStat);
|
||||||
|
|
||||||
@ -564,7 +817,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
feMesh.write();
|
feMesh.write();
|
||||||
|
|
||||||
|
|
||||||
// Write a featureEdgeMesh for backwards compatibility
|
// Write a featureEdgeMesh for backwards compatibility
|
||||||
{
|
{
|
||||||
featureEdgeMesh bfeMesh
|
featureEdgeMesh bfeMesh
|
||||||
@ -595,7 +847,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
sFeatFileName + ".closeness",
|
sFeatFileName + ".closeness",
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
"extendedFeatureEdgeMesh",
|
"triSurface",
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
@ -603,13 +855,6 @@ int main(int argc, char *argv[])
|
|||||||
surf
|
surf
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!curvature)
|
|
||||||
{
|
|
||||||
Info<< "End\n" << endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find close features
|
// Find close features
|
||||||
|
|
||||||
// // Dummy trim operation to mark features
|
// // Dummy trim operation to mark features
|
||||||
@ -677,8 +922,10 @@ int main(int argc, char *argv[])
|
|||||||
// )
|
// )
|
||||||
// );
|
// );
|
||||||
|
|
||||||
Info<< "Examine curvature, feature proximity and internal and "
|
if (args.optionFound("closeness"))
|
||||||
<< "external closeness." << endl;
|
{
|
||||||
|
Info<< nl << "Extracting internal and external closeness of surface."
|
||||||
|
<< endl;
|
||||||
|
|
||||||
// Internal and external closeness
|
// Internal and external closeness
|
||||||
|
|
||||||
@ -688,7 +935,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
scalar span = searchSurf.bounds().mag();
|
scalar span = searchSurf.bounds().mag();
|
||||||
|
|
||||||
args.optionReadIfPresent("closeness", span);
|
//args.optionReadIfPresent("closeness", span);
|
||||||
|
|
||||||
scalar externalAngleTolerance = 10;
|
scalar externalAngleTolerance = 10;
|
||||||
scalar externalToleranceCosAngle = Foam::cos
|
scalar externalToleranceCosAngle = Foam::cos
|
||||||
@ -842,7 +1089,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
sFeatFileName + ".internalCloseness",
|
sFeatFileName + ".internalCloseness",
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
"extendedFeatureEdgeMesh",
|
"triSurface",
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
@ -860,7 +1107,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
sFeatFileName + ".externalCloseness",
|
sFeatFileName + ".externalCloseness",
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
"extendedFeatureEdgeMesh",
|
"triSurface",
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
@ -872,39 +1119,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
externalClosenessField.write();
|
externalClosenessField.write();
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_CURVATURE
|
|
||||||
scalarField k = calcCurvature(surf);
|
|
||||||
|
|
||||||
// Modify the curvature values on feature edges and points to be zero.
|
|
||||||
|
|
||||||
forAll(newSet.featureEdges(), fEI)
|
|
||||||
{
|
|
||||||
const edge& e = surf.edges()[newSet.featureEdges()[fEI]];
|
|
||||||
|
|
||||||
k[surf.meshPoints()[e.start()]] = 0.0;
|
|
||||||
k[surf.meshPoints()[e.end()]] = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
triSurfacePointScalarField kField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
sFeatFileName + ".curvature",
|
|
||||||
runTime.constant(),
|
|
||||||
"extendedFeatureEdgeMesh",
|
|
||||||
runTime,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
surf,
|
|
||||||
dimLength,
|
|
||||||
k
|
|
||||||
);
|
|
||||||
|
|
||||||
kField.write();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (writeVTK)
|
if (writeVTK)
|
||||||
{
|
{
|
||||||
vtkSurfaceWriter().write
|
vtkSurfaceWriter().write
|
||||||
@ -930,8 +1144,47 @@ int main(int argc, char *argv[])
|
|||||||
false, // isNodeValues
|
false, // isNodeValues
|
||||||
true // verbose
|
true // verbose
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_CURVATURE
|
#ifdef ENABLE_CURVATURE
|
||||||
|
if (args.optionFound("curvature"))
|
||||||
|
{
|
||||||
|
Info<< nl << "Extracting curvature of surface at the points." << endl;
|
||||||
|
|
||||||
|
scalarField k = calcCurvature(surf);
|
||||||
|
|
||||||
|
// Modify the curvature values on feature edges and points to be zero.
|
||||||
|
|
||||||
|
// forAll(newSet.featureEdges(), fEI)
|
||||||
|
// {
|
||||||
|
// const edge& e = surf.edges()[newSet.featureEdges()[fEI]];
|
||||||
|
//
|
||||||
|
// k[surf.meshPoints()[e.start()]] = 0.0;
|
||||||
|
// k[surf.meshPoints()[e.end()]] = 0.0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
triSurfacePointScalarField kField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
sFeatFileName + ".curvature",
|
||||||
|
runTime.constant(),
|
||||||
|
"triSurface",
|
||||||
|
runTime,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surf,
|
||||||
|
dimLength,
|
||||||
|
k
|
||||||
|
);
|
||||||
|
|
||||||
|
kField.write();
|
||||||
|
|
||||||
|
if (writeVTK)
|
||||||
|
{
|
||||||
vtkSurfaceWriter().write
|
vtkSurfaceWriter().write
|
||||||
(
|
(
|
||||||
runTime.constant()/"triSurface", // outputDir
|
runTime.constant()/"triSurface", // outputDir
|
||||||
@ -943,7 +1196,82 @@ int main(int argc, char *argv[])
|
|||||||
true, // isNodeValues
|
true, // isNodeValues
|
||||||
true // verbose
|
true // verbose
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
if (args.optionFound("featureProximity"))
|
||||||
|
{
|
||||||
|
Info<< nl << "Extracting proximity of close feature points and edges "
|
||||||
|
<< "to the surface" << endl;
|
||||||
|
|
||||||
|
const scalar searchDistance =
|
||||||
|
args.optionRead<scalar>("featureProximity");
|
||||||
|
|
||||||
|
const scalar radiusSqr = sqr(searchDistance);
|
||||||
|
|
||||||
|
scalarField featureProximity(surf.size(), searchDistance);
|
||||||
|
|
||||||
|
forAll(surf, fI)
|
||||||
|
{
|
||||||
|
const triPointRef& tri = surf[fI].tri(surf.points());
|
||||||
|
const point& triCentre = tri.circumCentre();
|
||||||
|
|
||||||
|
List<pointIndexHit> hitList;
|
||||||
|
|
||||||
|
feMesh.allNearestFeatureEdges(triCentre, radiusSqr, hitList);
|
||||||
|
|
||||||
|
featureProximity[fI] =
|
||||||
|
calcProximityOfFeatureEdges
|
||||||
|
(
|
||||||
|
feMesh,
|
||||||
|
hitList,
|
||||||
|
featureProximity[fI]
|
||||||
|
);
|
||||||
|
|
||||||
|
feMesh.allNearestFeaturePoints(triCentre, radiusSqr, hitList);
|
||||||
|
|
||||||
|
featureProximity[fI] =
|
||||||
|
calcProximityOfFeaturePoints
|
||||||
|
(
|
||||||
|
hitList,
|
||||||
|
featureProximity[fI]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
triSurfaceScalarField featureProximityField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
sFeatFileName + ".featureProximity",
|
||||||
|
runTime.constant(),
|
||||||
|
"triSurface",
|
||||||
|
runTime,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surf,
|
||||||
|
dimLength,
|
||||||
|
featureProximity
|
||||||
|
);
|
||||||
|
|
||||||
|
featureProximityField.write();
|
||||||
|
|
||||||
|
if (writeVTK)
|
||||||
|
{
|
||||||
|
vtkSurfaceWriter().write
|
||||||
|
(
|
||||||
|
runTime.constant()/"triSurface", // outputDir
|
||||||
|
sFeatFileName, // surfaceName
|
||||||
|
surf.points(),
|
||||||
|
faces,
|
||||||
|
"featureProximity", // fieldName
|
||||||
|
featureProximity,
|
||||||
|
false, // isNodeValues
|
||||||
|
true // verbose
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|||||||
@ -60,7 +60,7 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pointField& points = patch_.localPoints();
|
const pointField& points = patch_.localPoints();
|
||||||
const faceList& faces = patch_.localFaces();
|
const List<typename Patch::FaceType>& faces = patch_.localFaces();
|
||||||
|
|
||||||
faceToPointWeightsPtr_ = new scalarListList(points.size());
|
faceToPointWeightsPtr_ = new scalarListList(points.size());
|
||||||
scalarListList& weights = *faceToPointWeightsPtr_;
|
scalarListList& weights = *faceToPointWeightsPtr_;
|
||||||
@ -118,7 +118,7 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pointField& points = patch_.localPoints();
|
const pointField& points = patch_.localPoints();
|
||||||
const faceList& faces = patch_.localFaces();
|
const List<typename Patch::FaceType>& faces = patch_.localFaces();
|
||||||
const edgeList& edges = patch_.edges();
|
const edgeList& edges = patch_.edges();
|
||||||
const labelListList& edgeFaces = patch_.edgeFaces();
|
const labelListList& edgeFaces = patch_.edgeFaces();
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ tmp<Field<Type> > PrimitivePatchInterpolation<Patch>::pointToFaceInterpolate
|
|||||||
|
|
||||||
Field<Type>& result = tresult();
|
Field<Type>& result = tresult();
|
||||||
|
|
||||||
const faceList& localFaces = patch_.localFaces();
|
const List<typename Patch::FaceType>& localFaces = patch_.localFaces();
|
||||||
|
|
||||||
forAll(result, facei)
|
forAll(result, facei)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "mergePoints.H"
|
#include "mergePoints.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "addToMemberFunctionSelectionTable.H"
|
#include "addToMemberFunctionSelectionTable.H"
|
||||||
|
#include "ListOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -112,35 +113,7 @@ void Foam::edgeMesh::calcPointEdges() const
|
|||||||
pointEdgesPtr_.reset(new labelListList(points_.size()));
|
pointEdgesPtr_.reset(new labelListList(points_.size()));
|
||||||
labelListList& pointEdges = pointEdgesPtr_();
|
labelListList& pointEdges = pointEdgesPtr_();
|
||||||
|
|
||||||
// Count
|
invertManyToMany(pointEdges.size(), edges_, pointEdges);
|
||||||
labelList nEdgesPerPoint(points_.size(), 0);
|
|
||||||
|
|
||||||
forAll(edges_, edgeI)
|
|
||||||
{
|
|
||||||
const edge& e = edges_[edgeI];
|
|
||||||
|
|
||||||
nEdgesPerPoint[e[0]]++;
|
|
||||||
nEdgesPerPoint[e[1]]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Size
|
|
||||||
forAll(pointEdges, pointI)
|
|
||||||
{
|
|
||||||
pointEdges[pointI].setSize(nEdgesPerPoint[pointI]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill
|
|
||||||
nEdgesPerPoint = 0;
|
|
||||||
|
|
||||||
forAll(edges_, edgeI)
|
|
||||||
{
|
|
||||||
const edge& e = edges_[edgeI];
|
|
||||||
const label p0 = e[0];
|
|
||||||
const label p1 = e[1];
|
|
||||||
|
|
||||||
pointEdges[p0][nEdgesPerPoint[p0]++] = edgeI;
|
|
||||||
pointEdges[p1][nEdgesPerPoint[p1]++] = edgeI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -819,6 +819,39 @@ void Foam::extendedFeatureEdgeMesh::nearestFeatureEdgeByType
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::extendedFeatureEdgeMesh::allNearestFeaturePoints
|
||||||
|
(
|
||||||
|
const point& sample,
|
||||||
|
scalar searchRadiusSqr,
|
||||||
|
List<pointIndexHit>& info
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
DynamicList<pointIndexHit> dynPointHit;
|
||||||
|
|
||||||
|
// Pick up all the feature points that intersect the search sphere
|
||||||
|
labelList elems = pointTree().findSphere
|
||||||
|
(
|
||||||
|
sample,
|
||||||
|
searchRadiusSqr
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(elems, elemI)
|
||||||
|
{
|
||||||
|
label index = elems[elemI];
|
||||||
|
label ptI = pointTree().shapes().pointLabels()[index];
|
||||||
|
const point& pt = points()[ptI];
|
||||||
|
|
||||||
|
pointIndexHit nearHit;
|
||||||
|
|
||||||
|
nearHit = pointIndexHit(true, pt, index);
|
||||||
|
|
||||||
|
dynPointHit.append(nearHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
info.transfer(dynPointHit);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::extendedFeatureEdgeMesh::allNearestFeatureEdges
|
void Foam::extendedFeatureEdgeMesh::allNearestFeatureEdges
|
||||||
(
|
(
|
||||||
const point& sample,
|
const point& sample,
|
||||||
|
|||||||
@ -283,6 +283,14 @@ public:
|
|||||||
List<pointIndexHit>& info
|
List<pointIndexHit>& info
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Find all the feature points within searchDistSqr of sample
|
||||||
|
void allNearestFeaturePoints
|
||||||
|
(
|
||||||
|
const point& sample,
|
||||||
|
scalar searchRadiusSqr,
|
||||||
|
List<pointIndexHit>& info
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Find all the feature edges within searchDistSqr of sample
|
//- Find all the feature edges within searchDistSqr of sample
|
||||||
void allNearestFeatureEdges
|
void allNearestFeatureEdges
|
||||||
(
|
(
|
||||||
@ -291,6 +299,7 @@ public:
|
|||||||
List<pointIndexHit>& info
|
List<pointIndexHit>& info
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the index of the start of the convex feature points
|
//- Return the index of the start of the convex feature points
|
||||||
|
|||||||
@ -93,6 +93,25 @@ bool Foam::treeDataPoint::overlaps
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check if any point on shape is inside sphere.
|
||||||
|
bool Foam::treeDataPoint::overlaps
|
||||||
|
(
|
||||||
|
const label index,
|
||||||
|
const point& centre,
|
||||||
|
const scalar radiusSqr
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
label pointI = (useSubset_ ? pointLabels_[index] : index);
|
||||||
|
|
||||||
|
if (magSqr(points_[pointI] - centre) <= radiusSqr)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Calculate nearest point to sample. Updates (if any) nearestDistSqr, minIndex,
|
// Calculate nearest point to sample. Updates (if any) nearestDistSqr, minIndex,
|
||||||
// nearestPoint.
|
// nearestPoint.
|
||||||
void Foam::treeDataPoint::findNearest
|
void Foam::treeDataPoint::findNearest
|
||||||
|
|||||||
@ -128,6 +128,14 @@ public:
|
|||||||
const treeBoundBox& sampleBb
|
const treeBoundBox& sampleBb
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Does shape at index overlap the sphere
|
||||||
|
bool overlaps
|
||||||
|
(
|
||||||
|
const label index,
|
||||||
|
const point& centre,
|
||||||
|
const scalar radiusSqr
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Calculates nearest (to sample) point in shape.
|
//- Calculates nearest (to sample) point in shape.
|
||||||
// Returns actual point and distance (squared)
|
// Returns actual point and distance (squared)
|
||||||
void findNearest
|
void findNearest
|
||||||
|
|||||||
Reference in New Issue
Block a user