Go to the documentation of this file.
70 vector& avgPos = avg[vertI];
72 if (fixedPoints.
test(vertI))
74 avgPos =
s.localPoints()[vertI];
78 const labelList& pEdges = pointEdges[vertI];
82 const edge&
e =
s.edges()[pEdges[myEdgeI]];
84 label otherVertI =
e.otherVertex(vertI);
86 avgPos +=
s.localPoints()[otherVertI];
89 avgPos /= pEdges.size();
119 <<
"Did not match all feature points to points on the surface"
125 if (from0To1[fpI] != -1)
127 fixedPoints.
set(from0To1[fpI]);
135 int main(
int argc,
char *argv[])
139 "Smooth a surface using lambda/mu smoothing.\n"
140 "For laplacian smoothing, set lambda to the relaxation factor"
155 "Fix points from a file containing feature points and edges"
165 if (lambda < 0 || lambda > 1)
169 <<
"0: no change 1: move vertices to average of neighbours"
172 if (mu < 0 || mu > 1)
176 <<
"0: no change 1: move vertices to average of neighbours"
181 <<
"mu : " <<
mu <<
nl
183 <<
"Reading surface from " << surfFileName <<
" ..." <<
endl;
187 Info<<
"Faces : " << surf1.size() <<
nl
188 <<
"Vertices : " << surf1.nPoints() <<
nl
189 <<
"Bounding Box: " <<
boundBox(surf1.localPoints()) <<
endl;
191 bitSet fixedPoints(surf1.localPoints().size(),
false);
196 Info<<
"Reading features from " << featureFileName <<
" ..." <<
endl;
200 getFixedPoints(feMesh, surf1.localPoints(), fixedPoints);
202 Info<<
"Number of fixed points on surface = " << fixedPoints.
count()
206 for (label iter = 0; iter <
iters; iter++)
212 (1 -
lambda)*surf1.localPoints()
213 +
lambda*avg(surf1, fixedPoints)
220 surf1.movePoints(newPoints);
228 (1 +
mu)*surf1.localPoints()
229 -
mu*avg(surf1, fixedPoints)
236 surf1.movePoints(newPoints);
240 Info<<
"Writing surface to " << outFileName <<
" ..." <<
endl;
241 surf1.
write(outFileName);
vectorField pointField
pointField is a vectorField.
const pointField & points() const noexcept
A class for handling file names.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
const dimensionedScalar mu
A class for managing temporary objects.
static constexpr const zero Zero
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
static void addNote(const string ¬e)
void set(const bitSet &bitset)
Extract command arguments and options from the supplied argc and argv parameters.
Ostream & endl(Ostream &os)
bool test(const label pos) const
T get(const label index) const
unsigned int count(const bool on=true) const
static void addArgument(const string &argName, const string &usage="")
Determine correspondence between points. See below.
Generic templated field type.
static HashTable< string > validOptions
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
virtual bool write(const token &tok)=0
loopControl iters(runTime, aMesh.solutionDict(), "solution")
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const dimensionedScalar e
A bounding box defined in terms of min/max extrema points.
A List with indirect addressing.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Foam::argList args(argc, argv)
Mesh data needed to do the Finite Area discretisation.
bool matchPoints(const UList< point > &pts0, const UList< point > &pts1, const UList< scalar > &matchDistance, const bool verbose, labelList &from0To1, const point &origin=point::zero)
#define WarningInFunction
bool found(const word &optName) const