64 vector& avgPos = avg[vertI];
66 if (fixedPoints[vertI])
68 avgPos =
s.localPoints()[vertI];
72 const labelList& pEdges = pointEdges[vertI];
76 const edge&
e =
s.edges()[pEdges[myEdgeI]];
78 label otherVertI =
e.otherVertex(vertI);
80 avgPos +=
s.localPoints()[otherVertI];
83 avgPos /= pEdges.
size();
113 <<
"Did not match all feature points to points on the surface"
119 if (from0To1[fpI] != -1)
121 fixedPoints[from0To1[fpI]] =
true;
129 int main(
int argc,
char *argv[])
142 "fix points from a file containing feature points and edges"
152 if (lambda < 0 || lambda > 1)
156 <<
"0: no change 1: move vertices to average of neighbours"
159 if (mu < 0 || mu > 1)
163 <<
"0: no change 1: move vertices to average of neighbours"
168 <<
"mu : " <<
mu <<
nl
169 <<
"Iters : " << iters <<
nl
170 <<
"Reading surface from " << surfFileName <<
" ..." <<
endl;
174 Info<<
"Faces : " << surf1.size() <<
nl
175 <<
"Vertices : " << surf1.nPoints() <<
nl
176 <<
"Bounding Box: " <<
boundBox(surf1.localPoints()) <<
endl;
183 Info<<
"Reading features from " << featureFileName <<
" ..." <<
endl;
187 getFixedPoints(feMesh, surf1.localPoints(), fixedPoints);
189 Info<<
"Number of fixed points on surface = " << fixedPoints.
count()
195 for (
label iter = 0; iter < iters; iter++)
201 (1 -
lambda)*surf1.localPoints()
202 +
lambda*avg(surf1, fixedPoints)
209 surf1.setPoints(newPoints);
217 (1 +
mu)*surf1.localPoints()
218 -
mu*avg(surf1, fixedPoints)
225 surf1.setPoints(newPoints);
229 Info<<
"Writing surface to " << outFileName <<
" ..." <<
endl;
230 surf1.
write(outFileName);
#define forAll(list, i)
Loop across all elements in list.
void size(const label)
Override size to be inconsistent with allocated storage.
virtual Ostream & write(const char)=0
Write character.
unsigned int count() const
Count number of bits set, O(log(n))
A List with indirect addressing.
Extract command arguments and options from the supplied argc and argv parameters.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
const string & option(const word &opt) const
Return the argument string associated with the named option.
static HashTable< string > validOptions
A list of valid options.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
T argRead(const label index) const
Read a value from the argument at index.
A bounding box defined in terms of the points at its extremities.
Points connected by edges.
const pointField & points() const
Return points.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling file names.
A class for managing temporary objects.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensionedScalar lambda(viscosity->lookup("lambda"))
Determine correspondence between points. See below.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar mu
Atomic mass unit.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorField pointField
pointField is a vectorField.
bool matchPoints(const UList< point > &pts0, const UList< point > &pts1, const UList< scalar > &matchDistance, const bool verbose, labelList &from0To1, const point &origin=point::zero)
Determine correspondence between pointFields. Gets passed.
Foam::argList args(argc, argv)