surfaceOrient.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "argList.H"
00032 #include "orientedSurface.H"
00033
00034 using namespace Foam;
00035
00036
00037
00038
00039
00040
00041 int main(int argc, char *argv[])
00042 {
00043 argList::noParallel();
00044 argList::validArgs.clear();
00045 argList::validArgs.append("Foam surface file");
00046 argList::validArgs.append("visiblePoint");
00047 argList::validArgs.append("output file");
00048 argList::validOptions.insert("inside", "");
00049 argList args(argc, argv);
00050
00051 fileName surfFileName(args.additionalArgs()[0]);
00052 Info<< "Reading surface from " << surfFileName << endl;
00053
00054 point visiblePoint(IStringStream(args.additionalArgs()[1])());
00055 Info<< "Visible point " << visiblePoint << endl;
00056
00057 bool orientInside = args.optionFound("inside");
00058
00059 if (orientInside)
00060 {
00061 Info<< "Orienting surface such that visiblePoint " << visiblePoint
00062 << " is inside" << endl;
00063 }
00064 else
00065 {
00066 Info<< "Orienting surface such that visiblePoint " << visiblePoint
00067 << " is outside" << endl;
00068 }
00069
00070 fileName outFileName(args.additionalArgs()[2]);
00071 Info<< "Writing surface to " << outFileName << endl;
00072
00073
00074
00075 triSurface surf(surfFileName);
00076
00077
00078 bool anyFlipped = orientedSurface::orient
00079 (
00080 surf,
00081 visiblePoint,
00082 !orientInside
00083 );
00084
00085 if (anyFlipped)
00086 {
00087 Info<< "Flipped orientation of (part of) surface." << endl;
00088 }
00089 else
00090 {
00091 Info<< "Did not flip orientation of any triangle of surface." << endl;
00092 }
00093
00094 Info<< "Writing new surface to " << outFileName << endl;
00095
00096 surf.write(outFileName);
00097
00098 Info << "End\n" << endl;
00099
00100 return 0;
00101 }
00102
00103
00104
Copyright © 2000-2009 OpenCFD Ltd