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[])
141 "fix points from a file containing feature points and edges" 151 if (lambda < 0 || lambda > 1)
155 <<
"0: no change 1: move vertices to average of neighbours" 158 if (mu < 0 || mu > 1)
162 <<
"0: no change 1: move vertices to average of neighbours" 166 Info<<
"lambda : " << lambda <<
nl 167 <<
"mu : " << mu <<
nl 168 <<
"Iters : " << iters <<
nl 169 <<
"Reading surface from " << surfFileName <<
" ..." <<
endl;
173 Info<<
"Faces : " << surf1.size() <<
nl 174 <<
"Vertices : " << surf1.nPoints() <<
nl 175 <<
"Bounding Box: " <<
boundBox(surf1.localPoints()) << endl;
182 Info<<
"Reading features from " << featureFileName <<
" ..." <<
endl;
186 getFixedPoints(feMesh, surf1.localPoints(), fixedPoints);
188 Info<<
"Number of fixed points on surface = " << fixedPoints.
count()
194 for (
label iter = 0; iter < iters; iter++)
200 (1 - lambda)*surf1.localPoints()
201 + lambda*avg(surf1, fixedPoints)
208 surf1.movePoints(newPoints);
216 (1 + mu)*surf1.localPoints()
217 - mu*avg(surf1, fixedPoints)
224 surf1.movePoints(newPoints);
228 Info<<
"Writing surface to " << outFileName <<
" ..." <<
endl;
229 surf1.
write(outFileName);
unsigned int count() const
Count number of bits set, O(log(n))
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.
static void noParallel()
Remove the parallel options.
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.
Determine correspondence between points. See below.
const labelListList & pointEdges() const
Return point-edge addressing.
const pointField & points() const
Return points.
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.
bool optionFound(const word &opt) const
Return true if the named option is found.
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. ...
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
Points connected by edges.
const string & option(const word &opt) const
Return the argument string associated with the named option.
T argRead(const label index) const
Read a value from the argument at index.
#define WarningInFunction
Report a warning using Foam::Warning.
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 Field< PointType > & localPoints() const
Return pointField of points in patch.