48 int main(
int argc,
char *argv[])
54 "add two surfaces via a geometric merge on points."
65 "provide additional points"
70 "combine regions from both surfaces"
84 Info<<
"Reading a surface and adding points from a file"
85 <<
"; merging the points and writing the surface to another file"
88 Info<<
"Surface : " << inFileName1<<
nl
89 <<
"Points : " <<
args[
"points"] <<
nl
90 <<
"Writing : " << outFileName <<
nl <<
endl;
94 Info<<
"Reading two surfaces"
95 <<
"; merging points and writing the surface to another file"
100 Info<<
"Regions from the two files will get merged" <<
nl
101 <<
"Do not use this option if you want to keep the regions"
102 <<
" separate" <<
nl <<
endl;
106 Info<<
"Regions from the two files will not get merged" <<
nl
107 <<
"Regions from " << inFileName2 <<
" will get offset so"
108 <<
" as not to overlap with the regions in " << inFileName1
113 Info<<
"Surface1 : " << inFileName1<<
nl
114 <<
"Surface2 : " << inFileName2<<
nl
115 <<
"Writing : " << outFileName <<
nl <<
endl;
121 surface1.writeStats(
Info);
124 const pointField& points1 = surface1.points();
134 Info<<
"Additional Points:" << extraPoints.size() <<
endl;
137 label pointi = pointsAll.size();
138 pointsAll.setSize(pointsAll.size() + extraPoints.size());
142 pointsAll[pointi++] = extraPoints[i];
145 combinedSurf =
triSurface(surface1, surface1.patches(), pointsAll);
152 surface2.writeStats(
Info);
159 const pointField& points2 = surface2.points();
168 pointsAll[pointi++] = points1[point1i];
173 pointsAll[pointi++] = points2[point2i];
182 facesAll[trianglei++] = surface1[facei];
184 label nRegions1 = surface1.patches().size();
189 Info<<
"Surface " << inFileName1 <<
" has " << nRegions1
192 <<
"All region numbers in " << inFileName2 <<
" will be offset"
193 <<
" by this amount" <<
nl <<
endl;
202 destTri[0] = tri[0] + points1.
size();
203 destTri[1] = tri[1] + points1.
size();
204 destTri[2] = tri[2] + points1.
size();
215 label nRegions2 = surface2.patches().size();
222 newPatches.
setSize(
max(nRegions1, nRegions2));
235 Info<<
"Regions from " << inFileName2 <<
" have been renumbered:"
237 <<
" old\tnew" <<
nl;
239 for (
label regionI = 0; regionI < nRegions2; regionI++)
241 Info<<
" " << regionI <<
'\t' << regionI+nRegions1
246 newPatches.
setSize(nRegions1 + nRegions2);
252 newPatches[newPatchi++] = surface1.patches()[
patchi];
257 newPatches[newPatchi++] = surface2.patches()[
patchi];
262 Info<<
"New patches:" <<
nl;
271 combinedSurf =
triSurface(facesAll, newPatches, pointsAll);
283 Info<<
"Writing : " << outFileName <<
endl;
286 combinedSurf.write(outFileName);
#define forAll(list, i)
Loop across all elements in list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
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.
static void addNote(const string &)
Add extra notes for the usage information.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
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 class for handling file names.
Triangle with additional region number.
label region() const
Return region label.
Triangulated surface description with patch information.
void cleanup(const bool verbose)
Remove non-valid triangles.
void writeStats(Ostream &) const
Write some statistics.
int main(int argc, char *argv[])
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.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Foam::argList args(argc, argv)