...
 
Commits (3)
......@@ -6,6 +6,7 @@ EXE_INC = \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
-lfiniteVolume -lmeshTools \
-lfiniteVolume \
-lmeshTools \
-L$(FOAM_LIBBIN) \
-lmeshLibrary
......@@ -6,6 +6,7 @@ EXE_INC = \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
-lfiniteVolume -lmeshTools \
-lfiniteVolume \
-lmeshTools \
-L$(FOAM_LIBBIN) \
-lmeshLibrary
......@@ -6,6 +6,7 @@ EXE_INC = \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
-lfiniteVolume -lmeshTools \
-lfiniteVolume \
-lmeshTools \
-L$(FOAM_LIBBIN) \
-lmeshLibrary
......@@ -6,6 +6,7 @@ EXE_INC = \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
-lfiniteVolume -lmeshTools \
-lfiniteVolume \
-lmeshTools \
-L$(FOAM_LIBBIN) \
-lmeshLibrary
......@@ -4,4 +4,6 @@ EXE_INC = \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = -lmeshTools
LIB_LIBS = \
-lsurfMesh \
-lmeshTools
......@@ -164,21 +164,19 @@ Foam::point Foam::Module::boundaryLayers::createNewVertex
if (treatPatches[patchLabel])
{
normal += f.normal(points);
normal += f.areaNormal(points);
}
else
{
v += f.normal(points);
v += f.areaNormal(points);
}
}
const scalar magV = mag(v) + VSMALL;
v /= magV;
v.normalise();
normal -= (normal & v)*v;
const scalar magN = mag(normal) + VSMALL;
normal /= magN;
normal.normalise();
forAllRow(pointPoints, bpI, ppI)
{
......@@ -922,11 +920,11 @@ void Foam::Module::boundaryLayers::createNewEdgeVerticesParallel
if (treatPatches[patchLabel])
{
normal[epI] += f.normal(points);
normal[epI] += f.areaNormal(points);
}
else
{
v[epI] += f.normal(points);
v[epI] += f.areaNormal(points);
}
}
}
......
......@@ -850,7 +850,7 @@ void Foam::Module::extrudeLayer::movePoints()
{
const face& f = faces[faceI];
lps.coordinates() -= f.normal(points);
lps.coordinates() -= f.areaNormal(points);
if (thickness_ < 0.0)
{
......@@ -943,7 +943,7 @@ void Foam::Module::extrudeLayer::movePoints()
{
const face& f = faces[faceI];
normal -= f.normal(points);
normal -= f.areaNormal(points);
if (thickness_ < 0.0)
{
......@@ -969,11 +969,7 @@ void Foam::Module::extrudeLayer::movePoints()
thickness *= 0.4;
}
const scalar d = mag(normal);
if (d > VSMALL)
{
normal /= d;
}
normal.normalise();
displacements[pI] = normal*thickness;
}
......
......@@ -81,8 +81,7 @@ bool Foam::Module::triangulateNonPlanarBaseFaces::findNonPlanarBoundaryFaces()
);
const point triCentre = tri.centre();
vector n = tri.normal();
n /= (mag(n) + VSMALL);
vector n = tri.unitNormal();
forAll(bf, pI)
{
......
......@@ -34,8 +34,7 @@ License
Foam::label Foam::Module::faceDecomposition::concaveVertex() const
{
vector n = f_.normal(points_);
n /= mag(n);
const vector n = f_.unitNormal(points_);
const edgeList edges = f_.edges();
......@@ -43,12 +42,11 @@ Foam::label Foam::Module::faceDecomposition::concaveVertex() const
forAll(edges, eI)
{
vector ev = edges[eI].vec(points_);
ev /= mag(ev);
const short next = (eI + 1) % f_.size();
vector evn = edges[next].vec(points_);
evn /= mag(evn);
const vector ev = edges[eI].unitVec(points_);
const vector evn = edges[next].unitVec(points_);
const vector prod = (ev ^ evn);
......@@ -106,8 +104,7 @@ bool Foam::Module::faceDecomposition::isFaceConvex() const
bool Foam::Module::faceDecomposition::isFacePlanar(const scalar tol) const
{
vector nref = f_.normal(points_);
nref /= mag(nref);
const vector nref = f_.unitNormal(points_);
forAll(f_, pI)
{
......
......@@ -272,13 +272,12 @@ inline Foam::faceList Foam::Module::help::mergePatchFaces
for (label nI = 0; nI<(patchFaces.size()-1); nI++)
{
vector n0 = patchFaces[nI].normal(polyPoints);
n0 /= mag(n0);
const vector n0 = patchFaces[nI].unitNormal(polyPoints);
for (label nJ = nI + 1; nJ < patchFaces.size(); nJ++)
{
vector n1 = patchFaces[nI].normal(polyPoints);
n1 /= mag(n1);
const vector n1 = patchFaces[nI].unitNormal(polyPoints);
if
(
help::shareAnEdge(patchFaces[nI], patchFaces[nJ])
......@@ -686,8 +685,7 @@ inline bool Foam::Module::help::findMinimizerPoint
forAll(origins, i)
{
//- use the normalized vector
vector n = normals[i];
n /= (mag(n) + VSMALL);
vector n = normalised(normals[i]);
const tensor t = n*n;
......@@ -1051,7 +1049,7 @@ inline bool Foam::Module::help::doTrianglesOverlap
return false;
}
vector n0 = tri0.normal();
vector n0 = tri0.areaNormal();
const scalar dn0 = mag(n0);
n0 /= (dn0 + VSMALL);
......@@ -1060,7 +1058,7 @@ inline bool Foam::Module::help::doTrianglesOverlap
return false;
}
vector n1 = tri1.normal();
vector n1 = tri1.areaNormal();
const scalar dn1 = mag(n1);
n1 /= (dn1 + VSMALL);
......@@ -1328,13 +1326,8 @@ inline bool Foam::Module::help::doTrianglesIntersect
return false;
}
vector n0 = tri0.normal();
const scalar dn0 = mag(n0);
n0 /= (dn0 + VSMALL);
vector n1 = tri1.normal();
const scalar dn1 = mag(n1);
n1 /= (dn1 + VSMALL);
const vector n0 = tri0.unitNormal();
const vector n1 = tri1.unitNormal();
//- distance of the points of the first triangle from the plane
//- of the second triangle
......@@ -1677,7 +1670,7 @@ inline bool Foam::Module::help::isFaceConvexAndOk
{
bool valid(true);
vector normal = f.normal(fp);
vector normal = f.areaNormal(fp);
const scalar magN = mag(normal);
//- face has zero area. All points are inverted
......
......@@ -702,7 +702,7 @@ bool Foam::Module::polyMeshGenChecks::checkMinTwist
fCentres[faceI]
);
const vector triArea = triangle.normal();
const vector triArea = triangle.areaNormal();
const scalar magTri = (mag(triArea) + VSMALL);
......@@ -762,7 +762,7 @@ bool Foam::Module::polyMeshGenChecks::checkMinTwist
fCentres[faceI]
);
const vector triArea = triangle.normal();
const vector triArea = triangle.areaNormal();
const scalar magTri = mag(triArea);
......@@ -857,7 +857,7 @@ bool Foam::Module::polyMeshGenChecks::checkMinTwist
fCentres[faceI]
);
const vector triArea = triangle.normal();
const vector triArea = triangle.areaNormal();
const scalar magTri = (mag(triArea) + VSMALL);
......@@ -1356,11 +1356,7 @@ bool Foam::Module::polyMeshGenChecks::checkTriangleTwist
fCentres[faceI]
);
vector prevN = tri.normal();
const scalar magTri = mag(prevN) + VSMALL;
prevN /= magTri;
vector prevN = tri.unitNormal();
// compare with other possible triangles
for (label pJ = pI + 1; pJ < f.size(); ++pJ)
......@@ -1372,11 +1368,7 @@ bool Foam::Module::polyMeshGenChecks::checkTriangleTwist
fCentres[faceI]
);
vector triN = tri.normal();
scalar magTriN = mag(triN) + VSMALL;
triN /= magTriN;
vector triN = tri.unitNormal();
if ((prevN & triN) < minTwist)
{
......@@ -2264,7 +2256,7 @@ void Foam::Module::polyMeshGenChecks::checkFaceSkewness
{
const vector d = fCentres[faceI] - centres[own[faceI]];
vector n = faces[faceI].normal(points);
vector n = faces[faceI].areaNormal(points);
const scalar magn = mag(n);
if (magn > VSMALL)
{
......
......@@ -101,7 +101,7 @@ inline Foam::vector Foam::Module::partTet::Sa(const PointField& points) const
points[data_[3]]
);
return tria.normal();
return tria.areaNormal();
//return triangle<point, point>(b_, c_, d_).normal();
}
......@@ -116,7 +116,7 @@ inline Foam::vector Foam::Module::partTet::Sb(const PointField& points) const
points[data_[2]]
);
return tria.normal();
return tria.areaNormal();
//return triangle<point, point>(a_, d_, c_).normal();
}
......@@ -131,7 +131,7 @@ inline Foam::vector Foam::Module::partTet::Sc(const PointField& points) const
points[data_[3]]
);
return tria.normal();
return tria.areaNormal();
//return triangle<point, point>(a_, b_, d_).normal();
}
......@@ -146,7 +146,7 @@ inline Foam::vector Foam::Module::partTet::Sd(const PointField& points) const
points[data_[1]]
);
return tria.normal();
return tria.areaNormal();
//return triangle<point, point>(a_, c_, b_).normal();
}
......
......@@ -311,8 +311,7 @@ void Foam::Module::triSurfAddressing::calculateFacetNormals() const
# endif
forAll(facets_, fI)
{
vector v = facets_[fI].normal(points_);
v /= (mag(v) + VSMALL);
vector v = facets_[fI].unitNormal(points_);
(*facetNormalsPtr_)[fI] = v;
}
}
......
......@@ -379,7 +379,7 @@ void Foam::Module::boundaryLayerOptimisation::calculateHairVectorsAtTheBoundary
forAllRow(edgeFaces, beI, befI)
{
const face& bf = bFaces[edgeFaces(beI, befI)];
const vector fNormal = bf.normal(points);
const vector fNormal = bf.areaNormal(points);
const label pos = bf.which(he.start());
......
......@@ -57,7 +57,7 @@ void Foam::Module::symmetryPlaneOptimisation::detectSymmetryPlanes()
for (label faceI = start; faceI < end; ++faceI)
{
cs.first += faces[faceI].centre(points);
ns.first += faces[faceI].normal(points);
ns.first += faces[faceI].areaNormal(points);
}
cs.second = ns.second = boundaries[patchI].patchSize();
......
......@@ -99,7 +99,7 @@ Foam::Module::knuppMetric::knuppMetric(partTetMeshSimplex& simplex)
points_[pt.c()]
);
const vector n = tri.normal();
const vector n = tri.areaNormal();
const scalar d = mag(n);
if (d > VSMALL)
......
......@@ -80,7 +80,7 @@ Foam::Module::quadricMetric::quadricMetric(partTetMeshSimplex& simplex)
points_[pt.c()]
);
const vector n = tri.normal();
const vector n = tri.areaNormal();
const scalar d = mag(n);
if (d > VSMALL)
......
......@@ -377,7 +377,7 @@ Foam::scalar Foam::Module::volumeOptimizer::optimiseSteepestDescent
points_[tet.c()]
);
vector n = tri.normal();
vector n = tri.areaNormal();
const scalar d = mag(n);
if (d > VSMALL)
......
......@@ -479,8 +479,7 @@ void Foam::Module::tetMeshOptimisation::optimiseBoundaryVolumeOptimizer
points[nodeI]
);
vector n = tri.normal();
n /= (mag(n) + VSMALL);
vector n = tri.unitNormal();
nt += symm(n*n);
}
......
......@@ -1041,10 +1041,8 @@ bool Foam::Module::edgeExtractor::distributeBoundaryFacesNormalAlignment()
maxDSq = Foam::max(dSq, maxDSq);
// calculate normal vectors
vector tn = surf[nearestTriangle].normal(sPoints);
tn /= (mag(tn) + VSMALL);
vector fn = bf.normal(points);
fn /= (mag(fn) + SMALL);
vector tn = surf[nearestTriangle].unitNormal(sPoints);
vector fn = bf.unitNormal(points);
// calculate alignment
normalAlignment[i] = mag(tn & fn);
......
......@@ -202,7 +202,7 @@ void Foam::Module::meshSurfaceCheckInvertedVertices::checkVertices()
fCentres[bfI]
);
vector nNext = triNext.normal();
vector nNext = triNext.areaNormal();
scalar mNext = mag(nNext);
// face has zero area
......@@ -259,7 +259,7 @@ void Foam::Module::meshSurfaceCheckInvertedVertices::checkVertices()
points[bf.prevLabel(pI)]
);
vector nPrev = triPrev.normal();
vector nPrev = triPrev.areaNormal();
scalar mPrev = mag(nPrev);
// face has zero area
......
......@@ -838,7 +838,7 @@ void Foam::Module::meshSurfaceEngine::calculateFaceNormals() const
{
const face& bf = bFaces[bfI];
faceNormalsPtr_->operator[](bfI) = bf.normal(points);
faceNormalsPtr_->operator[](bfI) = bf.areaNormal(points);
}
}
......
......@@ -96,7 +96,7 @@ void Foam::Module::meshSurfaceEngineModifier::moveBoundaryVertex
{
const label bfI = pFaces(bpI, pfI);
faceNormals[bfI] = bFaces[bfI].normal(points);
faceNormals[bfI] = bFaces[bfI].areaNormal(points);
}
}
......@@ -271,7 +271,7 @@ void Foam::Module::meshSurfaceEngineModifier::updateGeometry
forAll(updateFaces, bfI)
{
if (updateFaces[bfI])
faceNormals[bfI] = bFaces[bfI].normal(points);
faceNormals[bfI] = bFaces[bfI].areaNormal(points);
}
}
......
......@@ -141,7 +141,7 @@ Foam::scalar Foam::Module::meshSurfaceMapper::faceMetricInPatch
const pointFieldPMG& points = surfaceEngine_.points();
const point centre = bf.centre(points);
const vector area = bf.normal(points);
const vector area = bf.areaNormal(points);
point projCentre;
scalar dSq;
......@@ -178,7 +178,7 @@ Foam::scalar Foam::Module::meshSurfaceMapper::faceMetricInPatch
projPoints[pI],
projPoints[bf.fcIndex(pI)],
projCentre
).normal();
).areaNormal();
}
return magSqr(centre - projCentre) + mag(mag(projArea) - mag(area));
......
......@@ -179,7 +179,7 @@ void Foam::Module::triSurfaceClassifyEdges::checkOrientation()
{
const labelledTri& tri = surf[triI];
const point c = tri.centre(points);
vector n = tri.normal(points);
vector n = tri.areaNormal(points);
const scalar magN = mag(n);
if (magN < VSMALL)
......
......@@ -353,7 +353,7 @@ void Foam::Module::triSurfaceCurvatureEstimator::calculateSurfaceCurvatures()
continue;
otherLabels[regionI].insert(pI);
normals[regionI] += surface_[triI].normal(points);
normals[regionI] += surface_[triI].areaNormal(points);
}
}
......@@ -389,7 +389,7 @@ void Foam::Module::triSurfaceCurvatureEstimator::calculateSurfaceCurvatures()
forAllIters(normals, nit)
{
nit() /= (Foam::mag(nit()) + VSMALL);
nit().normalise();
}
forAllConstIters(otherLabels, it)
......
......@@ -6,6 +6,8 @@ EXE_INC = \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
-lfiniteVolume -lmeshTools \
-lfiniteVolume \
-lsurfMesh \
-lmeshTools \
-L$(FOAM_LIBBIN) \
-lmeshLibrary
......@@ -132,7 +132,7 @@ int main(int argc, char *argv[])
origSurf.writeSurface(outFileName);
// export surface subsets as separate surface meshes
if (args.optionFound("exportSubsets"))
if (args.found("exportSubsets"))
{
DynList<label> subsetIDs;
origSurf.facetSubsetIndices(subsetIDs);
......@@ -157,7 +157,7 @@ int main(int argc, char *argv[])
}
}
if (args.optionFound("exportFeatureEdges"))
if (args.found("exportFeatureEdges"))
{
fileName fName = outFileNoExt+"_featureEdges";
fName += ".vtk";
......
......@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
polyMeshGen pmg(runTime);
pmg.read();
const bool is2DLayer = args.optionFound("2DLayers");
const bool is2DLayer = args.found("2DLayers");
// generate the initial boundary layer
generateLayer(pmg, meshDict, is2DLayer);
......
......@@ -64,31 +64,31 @@ int main(int argc, char *argv[])
// Read the settings
if (!args.optionReadIfPresent("nLoops", nLoops))
if (!args.readIfPresent("nLoops", nLoops))
{
Info<< "Default number of loops is "
<< nLoops << endl;
}
if (!args.optionReadIfPresent("nIterations", nIterations))
if (!args.readIfPresent("nIterations", nIterations))
{
Info<< "Default number of iterations is "
<< nIterations << endl;
}
if (!args.optionReadIfPresent("nSurfaceIterations", nSurfaceIterations))
if (!args.readIfPresent("nSurfaceIterations", nSurfaceIterations))
{
Info<< "Default number of surface iterations is "
<< nSurfaceIterations << endl;
}
if (!args.optionReadIfPresent("qualityThreshold", qualityThreshold))
if (!args.readIfPresent("qualityThreshold", qualityThreshold))
{
Info<< "Using default quality threshold 0.1" << endl;
}
word constrainedCellSet;
if (!args.optionReadIfPresent("constrainedCellSet", constrainedCellSet))
if (!args.readIfPresent("constrainedCellSet", constrainedCellSet))
{
Info<< "No constraints applied on the smoothing procedure" << endl;
}
......
......@@ -6,6 +6,8 @@ EXE_INC = \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
-lfiniteVolume -lmeshTools \
-lfiniteVolume \
-lsurfMesh \
-lmeshTools \
-L$(FOAM_LIBBIN) \
-lmeshLibrary
......@@ -69,7 +69,8 @@ void getPatchIds
if (nFound != patchNames.size())
{
WarningInFunction
<< "Not all supplied patch names were found on the surface mesh" << endl;
<< "Not all supplied patch names were found on the surface mesh"
<< endl;
}
}
......@@ -321,12 +322,9 @@ int main(int argc, char *argv[])
fileName outFileName(inFileName);
if (args.optionFound("output"))
{
outFileName = args["output"];
}
args.readIfPresent("output", outFileName);
const bool keepPatches = args.optionFound("keep");
const bool keepPatches = args.found("keep");
// Read original surface
triSurf origSurf(inFileName);
......@@ -334,16 +332,16 @@ int main(int argc, char *argv[])
// Get patch ids
DynamicList<label> patchIds;
if (args.options().found("patchNames"))
if (args.found("patchNames"))
{
if (args.optionFound("patchIds"))
if (args.found("patchIds"))
{
FatalError() << "Cannot specify both patch names and ids"
FatalErrorInFunction
<< "Cannot specify both patch names and ids" << nl
<< Foam::abort(FatalError);
}
IStringStream is(args["patchNames"]);
wordList patchNames(is);
wordList patchNames(args.getList<word>("patchNames"));
getPatchIds
(
......@@ -352,20 +350,15 @@ int main(int argc, char *argv[])
patchIds
);
}
if (args.optionFound("patchIds"))
else if (args.found("patchIds"))
{
IStringStream is(args["patchIds"]);
patchIds.append(labelList(is));
patchIds.append(args.getList<label>("patchIds"));
}
if (args.optionFound("patchIdRange"))
labelPair idRange;
if (args.readIfPresent("patchIdRange", idRange))
{
IStringStream is(args["patchIdRange"]);
Pair<label> idRange(is);
for (label id = idRange.first(); id <= idRange.second(); id++)
for (label id = idRange.first(); id <= idRange.second(); ++id)
{
patchIds.append(id);
}
......@@ -373,7 +366,8 @@ int main(int argc, char *argv[])
if (!patchIds.size())
{
FatalError() << "No patches specified"
FatalErrorInFunction
<< "No patches specified" << nl
<< Foam::abort(FatalError);
}
......@@ -389,11 +383,11 @@ int main(int argc, char *argv[])
// Write new surface mesh
newSurf->writeSurface(outFileName);
Info<< "Original surface patches: " << origSurf.patches().size() << endl;
Info<< "Final surface patches: " << newSurf->patches().size() << endl;
Info<< "Surface written to " << outFileName << endl;
Info<< "Original surface patches: " << origSurf.patches().size() << nl
<< "Final surface patches: " << newSurf->patches().size() << nl
<< "Surface written to " << outFileName << endl;
Info<< "End\n" << endl;
Info<< "\nEnd\n" << endl;
return 0;
}
......
......@@ -3,4 +3,5 @@ EXE_INC = \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude
EXE_LIBS = \
-ldecompose
-ldecompose \
-ldecompositionMethods
......@@ -48,8 +48,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
// const scalar scalingFactor(readScalar(args[1]));
const scalar scalingFactor(args.argRead<scalar>(1));
const scalar scalingFactor(args.get<scalar>(1));
Info<< "Scaling mesh vertices by a factor " << scalingFactor << endl;
......
......@@ -54,8 +54,7 @@ int main(int argc, char *argv[])
const fileName inFileName(args[1]);
const fileName outFileName(args[2]);
// const scalar scalingFactor(readScalar(args[3]));
const scalar scalingFactor(args.argRead<scalar>(3));
const scalar scalingFactor(args.get<scalar>(3));
// read the surface mesh
triSurf surface(inFileName);
......
......@@ -6,6 +6,8 @@ EXE_INC = \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
-lfiniteVolume -lmeshTools \
-lfiniteVolume \
-lsurfMesh \
-lmeshTools \
-L$(FOAM_LIBBIN) \
-lmeshLibrary
......@@ -68,7 +68,7 @@ int main(int argc, char *argv[])
}
scalar tol(45.0);
if (!args.optionReadIfPresent("angle", tol))
if (!args.readIfPresent("angle", tol))
{
Info<< "Using 45 deg as default angle!" << endl;
}
......
......@@ -6,6 +6,8 @@ EXE_INC = \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
-lfiniteVolume -lmeshTools \
-lfiniteVolume \
-lsurfMesh \
-lmeshTools \
-L$(FOAM_LIBBIN) \
-lmeshLibrary
......@@ -6,6 +6,7 @@ EXE_INC = \
-I../../meshLibrary/lnInclude
EXE_LIBS = \
-lfiniteVolume -lmeshTools \
-lfiniteVolume \
-lmeshTools \
-L$(FOAM_LIBBIN) \
-lmeshLibrary
......@@ -52,7 +52,8 @@ int main(int argc, char *argv[])
const fileName inFileName(args[1]);
if (inFileName.ext() == "fms")
{
FatalError << "trying to convert a fms file to itself"
FatalErrorInFunction
<< "trying to convert a fms file to itself" << nl
<< exit(FatalError);
}
......