52 int main(
int argc,
char *argv[])
64 "point close to the patch; e.g., '(0 0 0.5)'"
71 "current name of the patch; e.g., patch0"
76 "Rename an existing patch to <new name> "
77 "in a surface geometry file.\n\n"
78 "The existing patch can be identified by one of two options:\n"
79 " -name <word>: selects the patch by name\n"
80 " -point <point>: select the nearest patch to the specified point\n\n"
82 "+ To rename 'patch0' to 'inlet'\n"
83 " surfaceRenamePatch -name patch0 inlet in.obj out.obj\n"
84 "+ To rename the patch nearest to the point '(1 2 3)' to 'inlet'\n"
85 " surfaceRenamePatch -point '(1 2 3)' inlet in.obj out.obj\n"
97 <<
"Missing option: -name or -point"
104 <<
"Both options provided: -patch and -point"
108 Info<<
"Reading surface " << inFile <<
nl <<
endl;
113 label surfZonei = -1;
119 forAll(surf.surfZones(), i)
121 const surfZone& sZone = surf.surfZones()[i];
123 if (sZone.
name() == surfZoneName)
135 <<
"Patch " << surfZoneName <<
" not found"
165 <<
"Patch nearest to " <<
p <<
" not found"
171 forAll(surf.surfZones(), i)
173 const surfZone& sZone = surf.surfZones()[i];
183 Info<<
"Found patch " << sZone.
name()
184 <<
" nearest to " <<
p <<
nl <<
endl;
192 Info<<
"Renaming '" << surf.surfZones()[surfZonei].name()
193 <<
"' to '" << newPatchName <<
"'"
196 surf.surfZones()[surfZonei].
name() = newPatchName;
198 Info<<
"Writing surface " << outFile <<
nl <<
endl;
#define forAll(list, i)
Loop across all elements in list.
virtual const fileName & name() const
Return the name of the stream.
virtual Ostream & write(const token &)
Write token.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label index() const
Return index.
bool hit() const
Is there a hit.
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.
static void addNote(const string &)
Add extra notes for the usage information.
T optionRead(const word &opt) const
Read a value from the named option.
bool optionFound(const word &opt) const
Return true if the named option is found.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
T argRead(const label index) const
Read a value from the argument at index.
A class for handling file names.
Non-pointer based hierarchical recursive searching.
const word & name() const
Return name.
A surface zone on a MeshedSurface.
label start() const
Return start label of this zone in the face list.
label size() const
Return size of this zone in the face list.
Standard boundBox + extra functionality for use in octree.
treeBoundBox extend(const scalar s) const
Return asymmetrically extended bounding box, with guaranteed.
Encapsulation of data needed to search on PrimitivePatches.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Foam::argList args(argc, argv)