48 int main(
int argc,
char *argv[])
52 "add two surfaces via a geometric merge on points." 64 "provide additional points" 69 "combine regions from both surfaces" 83 Info<<
"Reading a surface and adding points from a file" 84 <<
"; merging the points and writing the surface to another file" 87 Info<<
"Surface : " << inFileName1<< nl
88 <<
"Points : " <<
args[
"points"] << nl
89 <<
"Writing : " << outFileName << nl <<
endl;
93 Info<<
"Reading two surfaces" 94 <<
"; merging points and writing the surface to another file" 99 Info<<
"Regions from the two files will get merged" << nl
100 <<
"Do not use this option if you want to keep the regions" 101 <<
" separate" << nl <<
endl;
105 Info<<
"Regions from the two files will not get merged" << nl
106 <<
"Regions from " << inFileName2 <<
" will get offset so" 107 <<
" as not to overlap with the regions in " << inFileName1
112 Info<<
"Surface1 : " << inFileName1<< nl
113 <<
"Surface2 : " << inFileName2<< nl
114 <<
"Writing : " << outFileName << nl <<
endl;
120 surface1.writeStats(
Info);
123 const pointField& points1 = surface1.points();
133 Info<<
"Additional Points:" << extraPoints.size() <<
endl;
136 label pointi = pointsAll.size();
137 pointsAll.setSize(pointsAll.size() + extraPoints.size());
141 pointsAll[pointi++] = extraPoints[i];
144 combinedSurf =
triSurface(surface1, surface1.patches(), pointsAll);
151 surface2.writeStats(
Info);
158 const pointField& points2 = surface2.points();
167 pointsAll[pointi++] = points1[point1i];
172 pointsAll[pointi++] = points2[point2i];
181 facesAll[trianglei++] = surface1[facei];
183 label nRegions1 = surface1.patches().size();
188 Info<<
"Surface " << inFileName1 <<
" has " << nRegions1
191 <<
"All region numbers in " << inFileName2 <<
" will be offset" 192 <<
" by this amount" << nl <<
endl;
201 destTri[0] = tri[0] + points1.
size();
202 destTri[1] = tri[1] + points1.
size();
203 destTri[2] = tri[2] + points1.
size();
214 label nRegions2 = surface2.patches().size();
221 newPatches.
setSize(
max(nRegions1, nRegions2));
234 Info<<
"Regions from " << inFileName2 <<
" have been renumbered:" 236 <<
" old\tnew" <<
nl;
238 for (
label regionI = 0; regionI < nRegions2; regionI++)
240 Info<<
" " << regionI <<
'\t' << regionI+nRegions1
245 newPatches.
setSize(nRegions1 + nRegions2);
251 newPatches[newPatchi++] = surface1.patches()[
patchi];
256 newPatches[newPatchi++] = surface2.patches()[
patchi];
261 Info<<
"New patches:" <<
nl;
270 combinedSurf =
triSurface(facesAll, newPatches, pointsAll);
282 Info<<
"Writing : " << outFileName <<
endl;
285 combinedSurf.write(outFileName);
void cleanup(const bool verbose)
Remove non-valid triangles.
#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.
label region() const
Return region label.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void writeStats(Ostream &) const
Write some statistics.
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.
bool optionFound(const word &opt) const
Return true if the named option is found.
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.
Triangle with additional region number.
void setSize(const label)
Reset size of List.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
static void addNote(const string &)
Add extra notes for the usage information.
Triangulated surface description with patch information.
Foam::argList args(argc, argv)