80 int main(
int argc,
char *argv[])
100 Info<<
"Reading a surface and adding points from a file"
101 <<
"; merging the points and writing the surface to another file"
104 Info<<
"Surface : " << inFileName1<<
nl
106 <<
"Writing : " << outFileName <<
nl <<
endl;
110 Info<<
"Reading two surfaces"
111 <<
"; merging points and writing the surface to another file"
116 Info<<
"Regions from the two files will get merged" <<
nl
117 <<
"Do not use this option if you want to keep the regions"
118 <<
" separate" <<
nl <<
endl;
122 Info<<
"Regions from the two files will not get merged" <<
nl
123 <<
"Regions from " << inFileName2 <<
" will get offset so"
124 <<
" as not to overlap with the regions in " << inFileName1
129 Info<<
"Surface1 : " << inFileName1<<
nl
130 <<
"Surface2 : " << inFileName2<<
nl
131 <<
"Writing : " << outFileName <<
nl <<
endl;
137 surface1.writeStats(
Info);
140 const pointField& points1 = surface1.points();
150 Info<<
"Additional Points:" << extraPoints.size() <<
endl;
153 label pointI = pointsAll.size();
154 pointsAll.setSize(pointsAll.size() + extraPoints.size());
158 pointsAll[pointI++] = extraPoints[i];
161 combinedSurf =
triSurface(surface1, surface1.patches(), pointsAll);
168 surface2.writeStats(
Info);
175 const pointField& points2 = surface2.points();
184 pointsAll[pointi++] = points1[point1i];
189 pointsAll[pointi++] = points2[point2i];
198 facesAll[trianglei++] = surface1[faceI];
200 label nRegions1 = surface1.patches().size();
205 Info<<
"Surface " << inFileName1 <<
" has " << nRegions1
208 <<
"All region numbers in " << inFileName2 <<
" will be offset"
209 <<
" by this amount" <<
nl <<
endl;
218 destTri[0] = tri[0] + points1.
size();
219 destTri[1] = tri[1] + points1.
size();
220 destTri[2] = tri[2] + points1.
size();
231 label nRegions2 = surface2.patches().size();
238 newPatches.
setSize(
max(nRegions1, nRegions2));
240 forAll(surface1.patches(), patchI)
242 newPatches[patchI] = surface1.patches()[patchI];
244 forAll(surface2.patches(), patchI)
246 newPatches[patchI] = surface2.patches()[patchI];
251 Info<<
"Regions from " << inFileName2 <<
" have been renumbered:"
253 <<
" old\tnew" <<
nl;
255 for (label regionI = 0; regionI < nRegions2; regionI++)
257 Info<<
" " << regionI <<
'\t' << regionI+nRegions1
262 newPatches.
setSize(nRegions1 + nRegions2);
266 forAll(surface1.patches(), patchI)
268 newPatches[newPatchI++] = surface1.patches()[patchI];
271 forAll(surface2.patches(), patchI)
273 newPatches[newPatchI++] = surface2.patches()[patchI];
278 Info<<
"New patches:" <<
nl;
279 forAll(newPatches, patchI)
281 Info<<
" " << patchI <<
'\t' << newPatches[patchI].name() <<
nl;
287 combinedSurf =
triSurface(facesAll, newPatches, pointsAll);
299 Info <<
"Writing : " << outFileName <<
endl;
302 combinedSurf.write(outFileName);