64 vector& avgPos = avg[vertI];
66 if (fixedPoints[vertI])
72 const labelList& pEdges = pointEdges[vertI];
76 const edge& e = s.
edges()[pEdges[myEdgeI]];
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" 167 Info<<
"lambda : " << lambda <<
nl 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.movePoints(newPoints);
217 (1 + mu)*surf1.localPoints()
218 - mu*avg(surf1, fixedPoints)
225 surf1.movePoints(newPoints);
229 Info<<
"Writing surface to " << outFileName <<
" ..." <<
endl;
230 surf1.
write(outFileName);
const labelListList & pointEdges() const
Return point-edge addressing.
label nPoints() const
Return number of points supporting patch faces.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
A bounding box defined in terms of the points at its extremities.
label otherVertex(const label a) const
Given one vertex, return the other.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
Determine correspondence between points. See below.
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.
vectorField pointField
pointField is a vectorField.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
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.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const pointField & points() const
Return points.
Points connected by edges.
unsigned int count() const
Count number of bits set, O(log(n))
#define WarningInFunction
Report a warning using Foam::Warning.
T argRead(const label index) const
Read a value from the argument at index.
A List with indirect addressing.
virtual Ostream & write(const token &)=0
Write next token to stream.
A class for managing temporary objects.
Foam::argList args(argc, argv)
static HashTable< string > validOptions
A list of valid options.
const string & option(const word &opt) const
Return the argument string associated with the named option.