surfaceMeshConvert,surfaceMeshConvert,surfaceMeshImport: Updated coordinateSystem support

This commit is contained in:
Henry Weller
2020-09-29 16:10:06 +01:00
parent 31891a38b2
commit fe5e403cf9
3 changed files with 13 additions and 259 deletions

View File

@ -45,9 +45,6 @@ Usage
- \par -scaleOut \<scale\> \n
Specify a scaling factor when writing files.
- \par -dict \<dictionary\> \n
Specify an alternative dictionary for constant/coordinateSystems.
- \par -from \<coordinateSystem\> \n
Specify a coordinate system when reading files.
@ -103,7 +100,6 @@ int main(int argc, char *argv[])
"factor",
"geometry scaling factor on output - default is 1"
);
#include "addDictOption.H"
argList::addOption
(
"from",
@ -143,103 +139,28 @@ int main(int argc, char *argv[])
}
// get the coordinate transformations
// Get the coordinate transformations
autoPtr<coordinateSystem> fromCsys;
autoPtr<coordinateSystem> toCsys;
if (args.optionFound("from") || args.optionFound("to"))
{
autoPtr<IOobject> ioPtr;
if (args.optionFound("dict"))
{
const fileName dictPath = args["dict"];
ioPtr.set
(
new IOobject
(
(
isDir(dictPath)
? dictPath/coordinateSystems::typeName
: dictPath
),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
}
else
{
ioPtr.set
(
new IOobject
(
coordinateSystems::typeName,
runTime.constant(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
}
if (!ioPtr->typeHeaderOk<coordinateSystems>(false))
{
FatalErrorInFunction
<< ioPtr->objectPath() << nl
<< exit(FatalError);
}
coordinateSystems csLst(ioPtr());
coordinateSystems::coordinateSystems csLst(runTime);
if (args.optionFound("from"))
{
const word csName = args["from"];
const label csIndex = csLst.findIndex(csName);
if (csIndex < 0)
{
FatalErrorInFunction
<< "Cannot find -from " << csName << nl
<< "available coordinateSystems: " << csLst.toc() << nl
<< exit(FatalError);
}
fromCsys.reset(new coordinateSystem(csLst[csIndex]));
fromCsys = csLst[csName].clone();
}
if (args.optionFound("to"))
{
const word csName = args["to"];
const label csIndex = csLst.findIndex(csName);
if (csIndex < 0)
{
FatalErrorInFunction
<< "Cannot find -to " << csName << nl
<< "available coordinateSystems: " << csLst.toc() << nl
<< exit(FatalError);
}
toCsys.reset(new coordinateSystem(csLst[csIndex]));
}
// maybe fix this later
if (fromCsys.valid() && toCsys.valid())
{
FatalErrorInFunction
<< exit(FatalError);
toCsys = csLst[csName].clone();
}
}
MeshedSurface<face> surf(importName);
if (args.optionFound("clean"))