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
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 #include <OpenFOAM/argList.H>
00063 #include <meshTools/orientedSurface.H>
00064
00065 using namespace Foam;
00066
00067
00068
00069
00070
00071
00072 int main(int argc, char *argv[])
00073 {
00074 argList::noParallel();
00075 argList::validArgs.clear();
00076 argList::validArgs.append("Foam surface file");
00077 argList::validArgs.append("visiblePoint");
00078 argList::validArgs.append("output file");
00079 argList::validOptions.insert("inside", "");
00080 argList args(argc, argv);
00081
00082 fileName surfFileName(args.additionalArgs()[0]);
00083 Info<< "Reading surface from " << surfFileName << endl;
00084
00085 point visiblePoint(IStringStream(args.additionalArgs()[1])());
00086 Info<< "Visible point " << visiblePoint << endl;
00087
00088 bool orientInside = args.optionFound("inside");
00089
00090 if (orientInside)
00091 {
00092 Info<< "Orienting surface such that visiblePoint " << visiblePoint
00093 << " is inside" << endl;
00094 }
00095 else
00096 {
00097 Info<< "Orienting surface such that visiblePoint " << visiblePoint
00098 << " is outside" << endl;
00099 }
00100
00101 fileName outFileName(args.additionalArgs()[2]);
00102 Info<< "Writing surface to " << outFileName << endl;
00103
00104
00105
00106 triSurface surf(surfFileName);
00107
00108
00109 bool anyFlipped = orientedSurface::orient
00110 (
00111 surf,
00112 visiblePoint,
00113 !orientInside
00114 );
00115
00116 if (anyFlipped)
00117 {
00118 Info<< "Flipped orientation of (part of) surface." << endl;
00119 }
00120 else
00121 {
00122 Info<< "Did not flip orientation of any triangle of surface." << endl;
00123 }
00124
00125 Info<< "Writing new surface to " << outFileName << endl;
00126
00127 surf.write(outFileName);
00128
00129 Info << "End\n" << endl;
00130
00131 return 0;
00132 }
00133
00134
00135