Replace a few uses of triSurface with the more general meshedSurface.

This commit is contained in:
Mark Olesen
2010-01-15 17:27:03 +01:00
parent 7a200e81b4
commit a694f6e374
19 changed files with 72 additions and 106 deletions

View File

@ -1,6 +1,6 @@
EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude
-I$(LIB_SRC)/surfMesh/lnInclude
EXE_LIBS = \
-lmeshTools \
-ltriSurface
-lsurfMesh

View File

@ -23,18 +23,16 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Finds nearest triangle and vertex.
Finds nearest face and vertex.
\*---------------------------------------------------------------------------*/
#include "triSurface.H"
#include "argList.H"
#include "OFstream.H"
#ifndef namespaceFoam
#define namespaceFoam
using namespace Foam;
#endif
#include "MeshedSurfaces.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,9 +42,9 @@ int main(int argc, char *argv[])
{
argList::noParallel();
argList::validArgs.clear();
argList::addOption("x", "X");
argList::addOption("y", "Y");
argList::addOption("z", "Z");
argList::addOption("x", "X", "The point x-coordinate (if non-zero)");
argList::addOption("y", "Y", "The point y-coordinate (if non-zero)");
argList::addOption("z", "Z", "The point y-coordinate (if non-zero)");
argList::validArgs.append("surface file");
@ -54,15 +52,15 @@ int main(int argc, char *argv[])
point samplePt
(
args.optionRead<scalar>("x"),
args.optionRead<scalar>("y"),
args.optionRead<scalar>("z")
args.optionLookupOrDefault<scalar>("x", 0),
args.optionLookupOrDefault<scalar>("y", 0),
args.optionLookupOrDefault<scalar>("z", 0)
);
Info<< "Looking for nearest face/vertex to " << samplePt << endl;
Info<< "Reading surf1 ..." << endl;
triSurface surf1(args.additionalArgs()[0]);
Info<< "Reading surf ..." << endl;
meshedSurface surf1(args.additionalArgs()[0]);
//
// Nearest vertex
@ -83,11 +81,11 @@ int main(int argc, char *argv[])
}
}
Info<< "Nearest vertex:" << endl
<< " index :" << minIndex << " (in localPoints)" << endl
Info<< "Nearest vertex:" << nl
<< " index :" << minIndex << " (in localPoints)" << nl
<< " index :" << surf1.meshPoints()[minIndex]
<< " (in points)" << endl
<< " coordinates:" << localPoints[minIndex] << endl
<< " (in points)" << nl
<< " coordinates:" << localPoints[minIndex] << nl
<< endl;
//
@ -101,8 +99,7 @@ int main(int argc, char *argv[])
forAll(surf1, faceI)
{
const labelledTri& f = surf1[faceI];
const point centre = f.centre(points);
const point centre = surf1[faceI].centre(points);
const scalar dist = mag(centre - samplePt);
if (dist < minDist)
@ -112,16 +109,19 @@ int main(int argc, char *argv[])
}
}
const labelledTri& f = surf1[minIndex];
const face& f = surf1[minIndex];
Info<< "Face with nearest centre:" << endl
<< " index :" << minIndex << endl
<< " centre :" << f.centre(points) << endl
<< " face :" << f << endl
<< " vertex coords:" << points[f[0]] << " "
<< points[f[1]] << " " << points[f[2]] << endl
<< endl;
Info<< "Face with nearest centre:" << nl
<< " index :" << minIndex << nl
<< " centre :" << f.centre(points) << nl
<< " face :" << f << nl
<< " vertex coords:\n";
forAll(f, fp)
{
Info<< " " << points[f[fp]] << "\n";
}
Info<< endl;
Info<< "End\n" << endl;