mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
argList gets addNote() static method
- output any notes in the usage
This commit is contained in:
@ -23,8 +23,8 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Transform (scale/rotate) a surface. Like transformPoints but then for
|
Transform (scale/rotate) a surface.
|
||||||
surfaces.
|
Like transformPoints but for surfaces.
|
||||||
|
|
||||||
The rollPitchYaw option takes three angles (degrees):
|
The rollPitchYaw option takes three angles (degrees):
|
||||||
- roll (rotation about x) followed by
|
- roll (rotation about x) followed by
|
||||||
@ -54,16 +54,47 @@ using namespace Foam::constant::mathematical;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
argList::addNote
|
||||||
|
(
|
||||||
|
"Transform (scale/rotate) a surface. "
|
||||||
|
"Like transformPoints but for surfaces."
|
||||||
|
);
|
||||||
argList::noParallel();
|
argList::noParallel();
|
||||||
argList::validArgs.clear();
|
argList::validArgs.clear();
|
||||||
|
|
||||||
argList::validArgs.append("surface file");
|
argList::validArgs.append("surface file");
|
||||||
argList::validArgs.append("output surface file");
|
argList::validArgs.append("output surface file");
|
||||||
argList::addOption("translate", "vector");
|
argList::addOption
|
||||||
argList::addOption("rotate", "(vector vector)");
|
(
|
||||||
argList::addOption("scale", "vector");
|
"translate",
|
||||||
argList::addOption("rollPitchYaw", "(roll pitch yaw)");
|
"vector",
|
||||||
argList::addOption("yawPitchRoll", "(yaw pitch roll)");
|
"translate by the specified <vector> - eg, '(1 0 0)'"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"rotate",
|
||||||
|
"(vectorA vectorB)",
|
||||||
|
"transform in terms of a rotation between <vectorA> and <vectorB> "
|
||||||
|
"- eg, '( (1 0 0) (0 0 1) )'"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"scale",
|
||||||
|
"vector",
|
||||||
|
"scale by the specified amount - eg, '(0.001 0.001 0.001)' for a "
|
||||||
|
"uniform [mm] to [m] scaling"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"rollPitchYaw",
|
||||||
|
"vector",
|
||||||
|
"transform in terms of '( roll pitch yaw )' in degrees"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"yawPitchRoll",
|
||||||
|
"vector",
|
||||||
|
"transform in terms of '( yaw pitch roll )' in degrees"
|
||||||
|
);
|
||||||
argList args(argc, argv);
|
argList args(argc, argv);
|
||||||
|
|
||||||
fileName surfFileName(args.additionalArgs()[0]);
|
fileName surfFileName(args.additionalArgs()[0]);
|
||||||
|
|||||||
@ -43,6 +43,7 @@ Foam::SLList<Foam::string> Foam::argList::validArgs;
|
|||||||
Foam::HashTable<Foam::string> Foam::argList::validOptions;
|
Foam::HashTable<Foam::string> Foam::argList::validOptions;
|
||||||
Foam::HashTable<Foam::string> Foam::argList::validParOptions;
|
Foam::HashTable<Foam::string> Foam::argList::validParOptions;
|
||||||
Foam::HashTable<Foam::string> Foam::argList::optionUsage;
|
Foam::HashTable<Foam::string> Foam::argList::optionUsage;
|
||||||
|
Foam::SLList<Foam::string> Foam::argList::notes;
|
||||||
Foam::string::size_type Foam::argList::usageMin = 20;
|
Foam::string::size_type Foam::argList::usageMin = 20;
|
||||||
Foam::string::size_type Foam::argList::usageMax = 80;
|
Foam::string::size_type Foam::argList::usageMax = 80;
|
||||||
|
|
||||||
@ -108,6 +109,15 @@ void Foam::argList::addUsage
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::argList::addNote(const string& note)
|
||||||
|
{
|
||||||
|
if (!note.empty())
|
||||||
|
{
|
||||||
|
notes.append(note);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::argList::removeOption(const word& opt)
|
void Foam::argList::removeOption(const word& opt)
|
||||||
{
|
{
|
||||||
validOptions.erase(opt);
|
validOptions.erase(opt);
|
||||||
@ -765,7 +775,7 @@ void Foam::argList::printUsage() const
|
|||||||
|
|
||||||
HashTable<string>::const_iterator iter = validOptions.find(optionName);
|
HashTable<string>::const_iterator iter = validOptions.find(optionName);
|
||||||
Info<< " -" << optionName;
|
Info<< " -" << optionName;
|
||||||
label len = optionName.size() + 3; // include leading " -"
|
label len = optionName.size() + 3; // length includes leading ' -'
|
||||||
|
|
||||||
if (iter().size())
|
if (iter().size())
|
||||||
{
|
{
|
||||||
@ -815,6 +825,22 @@ void Foam::argList::printUsage() const
|
|||||||
"print the usage"
|
"print the usage"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// output notes directly - no automatic text wrapping
|
||||||
|
if (!notes.empty())
|
||||||
|
{
|
||||||
|
Info<< nl;
|
||||||
|
for
|
||||||
|
(
|
||||||
|
SLList<string>::const_iterator iter = notes.begin();
|
||||||
|
iter != notes.end();
|
||||||
|
++iter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Info<< iter().c_str() << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<<"Using OpenFOAM-" << Foam::FOAMversion
|
<<"Using OpenFOAM-" << Foam::FOAMversion
|
||||||
<<" (build: " << Foam::FOAMbuild << ") - see www.OpenFOAM.org"
|
<<" (build: " << Foam::FOAMbuild << ") - see www.OpenFOAM.org"
|
||||||
|
|||||||
@ -153,7 +153,10 @@ public:
|
|||||||
//- Short usage information for validOptions
|
//- Short usage information for validOptions
|
||||||
static HashTable<string> optionUsage;
|
static HashTable<string> optionUsage;
|
||||||
|
|
||||||
//- Min offset for displaying usage (default: 16)
|
//- Additional notes for usage
|
||||||
|
static SLList<string> notes;
|
||||||
|
|
||||||
|
//- Min offset for displaying usage (default: 20)
|
||||||
static string::size_type usageMin;
|
static string::size_type usageMin;
|
||||||
|
|
||||||
//- Max screen width for displaying usage (default: 80)
|
//- Max screen width for displaying usage (default: 80)
|
||||||
@ -287,6 +290,10 @@ public:
|
|||||||
const string& usage
|
const string& usage
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Add extra notes for the usage information
|
||||||
|
// This string is used "as-is" without additional formatting
|
||||||
|
static void addNote(const string&);
|
||||||
|
|
||||||
//- Remove option from validOptions and from optionUsage
|
//- Remove option from validOptions and from optionUsage
|
||||||
static void removeOption(const word& opt);
|
static void removeOption(const word& opt);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user