mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-coordinateSystem' into 'develop'
coordinate system improvements See merge request Development/OpenFOAM-plus!211
This commit is contained in:
@ -9,74 +9,74 @@ FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class IOPtrList<coordinateSystem>;
|
||||
class coordinateSystems;
|
||||
object coordinateSystems;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
7
|
||||
|
||||
(
|
||||
system_9
|
||||
_9
|
||||
{
|
||||
type cartesian;
|
||||
origin (1.03291515 -0.114391257 -0.0826236662);
|
||||
e3 (1 0 0);
|
||||
e1 (0 1 0);
|
||||
// STARCDRotation (0 90 90);
|
||||
e3 (1 0 0);
|
||||
// rotation { type starcd; angles (0 90 90); }
|
||||
}
|
||||
|
||||
system_10
|
||||
_10
|
||||
{
|
||||
type cartesian;
|
||||
origin (0.623151719 -0.286472935 -0.113933262);
|
||||
e3 (0.99508851 0.09829095 0.01173645);
|
||||
e1 (0.01179356 0 -0.99993045);
|
||||
// STARCDRotation (5.6403745 -0.0664172952 89.3275351);
|
||||
e3 (0.99508851 0.09829095 0.01173645);
|
||||
// rotation { type starcd; angles (5.6403745 -0.0664172952 89.3275351); }
|
||||
}
|
||||
|
||||
system_15
|
||||
_15
|
||||
{
|
||||
type cartesian;
|
||||
origin (0.644772231 -0.240036493 0.155972187);
|
||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||
e1 (0.00627978 0.42265304 -0.90626981);
|
||||
// STARCDRotation (-90.8512386 0 115.005148);
|
||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||
// rotation { type starcd; angles (-90.8512386 0 115.005148); }
|
||||
}
|
||||
|
||||
system_16
|
||||
_16
|
||||
{
|
||||
type cartesian;
|
||||
origin (0.540824938 -0.240036415 0.15928296);
|
||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||
e1 (0.00627978 0.42265304 -0.90626981);
|
||||
// STARCDRotation (-90.8512386 0 115.005148);
|
||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||
// rotation { type starcd; angles (-90.8512386 0 115.005148); }
|
||||
}
|
||||
|
||||
system_17
|
||||
_17
|
||||
{
|
||||
type cartesian;
|
||||
origin (0.436877646 -0.240036339 0.162593737);
|
||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||
e1 (0.00627978 0.42265304 -0.90626981);
|
||||
// STARCDRotation (-90.8512386 0 115.005148);
|
||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||
// rotation { type starcd; angles (-90.8512386 0 115.005148); }
|
||||
}
|
||||
|
||||
system_18
|
||||
_18
|
||||
{
|
||||
type cartesian;
|
||||
origin (0.332930354 -0.240036261 0.16590451);
|
||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||
e1 (0.00627978 0.42265304 -0.90626981);
|
||||
// STARCDRotation (-90.8512386 0 115.005148);
|
||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||
// rotation { type starcd; angles (-90.8512386 0 115.005148); }
|
||||
}
|
||||
|
||||
system_21
|
||||
_21
|
||||
{
|
||||
type cartesian;
|
||||
origin (0.55863733 -0.300866705 0.00317260982);
|
||||
e3 (0.42110287 0.02470132 -0.90667647);
|
||||
e1 (0.90646036 0.02342535 0.42164069);
|
||||
// STARCDRotation (-178.185897 -0.71772221 -155.059695);
|
||||
e3 (0.42110287 0.02470132 -0.90667647);
|
||||
// rotation { type starcd; angles (-178.185897 -0.71772221 -155.059695); }
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -66,6 +66,7 @@ Note
|
||||
|
||||
#include "MeshedSurfaces.H"
|
||||
#include "coordinateSystems.H"
|
||||
#include "cartesianCS.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -146,9 +147,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// get the coordinate transformations
|
||||
autoPtr<coordinateSystem> fromCsys;
|
||||
autoPtr<coordinateSystem> toCsys;
|
||||
// The coordinate transformations (must be cartesian)
|
||||
autoPtr<coordSystem::cartesian> fromCsys;
|
||||
autoPtr<coordSystem::cartesian> toCsys;
|
||||
|
||||
if (args.found("from") || args.found("to"))
|
||||
{
|
||||
@ -174,46 +175,47 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
coordinateSystems csLst(ioCsys);
|
||||
coordinateSystems globalCoords(ioCsys);
|
||||
|
||||
if (args.found("from"))
|
||||
{
|
||||
const word csName = args["from"];
|
||||
const word csName(args["from"]);
|
||||
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||
|
||||
const label csIndex = csLst.findIndex(csName);
|
||||
if (csIndex < 0)
|
||||
if (!csPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find -from " << csName << nl
|
||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
||||
<< "available coordinateSystems: "
|
||||
<< flatOutput(globalCoords.names()) << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
fromCsys.reset(new coordinateSystem(csLst[csIndex]));
|
||||
fromCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||
}
|
||||
|
||||
if (args.found("to"))
|
||||
{
|
||||
const word csName = args["to"];
|
||||
const word csName(args["to"]);
|
||||
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||
|
||||
const label csIndex = csLst.findIndex(csName);
|
||||
if (csIndex < 0)
|
||||
if (!csPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find -to " << csName << nl
|
||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
||||
<< "available coordinateSystems: "
|
||||
<< flatOutput(globalCoords.names()) << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
toCsys.reset(new coordinateSystem(csLst[csIndex]));
|
||||
toCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||
}
|
||||
|
||||
|
||||
// maybe fix this later
|
||||
if (fromCsys.valid() && toCsys.valid())
|
||||
// Maybe fix this later
|
||||
if (fromCsys && toCsys)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Only allowed '-from' or '-to' option at the moment."
|
||||
<< "Only allowed '-from' or '-to' option at the moment."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -230,29 +232,30 @@ int main(int argc, char *argv[])
|
||||
scalar scaleIn = 0;
|
||||
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||
{
|
||||
Info<< " -scaleIn " << scaleIn << endl;
|
||||
Info<< "scale input " << scaleIn << endl;
|
||||
surf.scalePoints(scaleIn);
|
||||
}
|
||||
|
||||
|
||||
if (fromCsys.valid())
|
||||
if (fromCsys)
|
||||
{
|
||||
Info<< " -from " << fromCsys().name() << endl;
|
||||
tmp<pointField> tpf = fromCsys().localPosition(surf.points());
|
||||
Info<< "move points from coordinate system: "
|
||||
<< fromCsys->name() << endl;
|
||||
tmp<pointField> tpf = fromCsys->localPosition(surf.points());
|
||||
surf.movePoints(tpf());
|
||||
}
|
||||
|
||||
if (toCsys.valid())
|
||||
if (toCsys)
|
||||
{
|
||||
Info<< " -to " << toCsys().name() << endl;
|
||||
tmp<pointField> tpf = toCsys().globalPosition(surf.points());
|
||||
Info<< "move points to coordinate system: "
|
||||
<< toCsys->name() << endl;
|
||||
tmp<pointField> tpf = toCsys->globalPosition(surf.points());
|
||||
surf.movePoints(tpf());
|
||||
}
|
||||
|
||||
scalar scaleOut = 0;
|
||||
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||
{
|
||||
Info<< " -scaleOut " << scaleOut << endl;
|
||||
Info<< "scale output " << scaleOut << endl;
|
||||
surf.scalePoints(scaleOut);
|
||||
}
|
||||
|
||||
|
||||
@ -67,6 +67,7 @@ Note
|
||||
|
||||
#include "MeshedSurfaces.H"
|
||||
#include "coordinateSystems.H"
|
||||
#include "cartesianCS.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -135,9 +136,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// get the coordinate transformations
|
||||
autoPtr<coordinateSystem> fromCsys;
|
||||
autoPtr<coordinateSystem> toCsys;
|
||||
// The coordinate transformations (must be cartesian)
|
||||
autoPtr<coordSystem::cartesian> fromCsys;
|
||||
autoPtr<coordSystem::cartesian> toCsys;
|
||||
|
||||
if (args.found("from") || args.found("to"))
|
||||
{
|
||||
@ -162,45 +163,47 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
coordinateSystems csLst(ioCsys);
|
||||
coordinateSystems globalCoords(ioCsys);
|
||||
|
||||
if (args.found("from"))
|
||||
{
|
||||
const word csName = args["from"];
|
||||
const word csName(args["from"]);
|
||||
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||
|
||||
const label csIndex = csLst.findIndex(csName);
|
||||
if (csIndex < 0)
|
||||
if (!csPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find -from " << csName << nl
|
||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
||||
<< "available coordinateSystems: "
|
||||
<< flatOutput(globalCoords.names()) << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
fromCsys.reset(new coordinateSystem(csLst[csIndex]));
|
||||
fromCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||
}
|
||||
|
||||
if (args.found("to"))
|
||||
{
|
||||
const word csName = args["to"];
|
||||
const word csName(args["to"]);
|
||||
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||
|
||||
const label csIndex = csLst.findIndex(csName);
|
||||
if (csIndex < 0)
|
||||
if (!csPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find -to " << csName << nl
|
||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
||||
<< "available coordinateSystems: "
|
||||
<< flatOutput(globalCoords.names()) << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
toCsys.reset(new coordinateSystem(csLst[csIndex]));
|
||||
toCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||
}
|
||||
|
||||
|
||||
// maybe fix this later
|
||||
if (fromCsys.valid() && toCsys.valid())
|
||||
// Maybe fix this later
|
||||
if (fromCsys && toCsys)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Only allowed '-from' or '-to' option at the moment."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -233,28 +236,30 @@ int main(int argc, char *argv[])
|
||||
scalar scaleIn = 0;
|
||||
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||
{
|
||||
Info<< " -scaleIn " << scaleIn << endl;
|
||||
Info<< "scale input " << scaleIn << endl;
|
||||
surf.scalePoints(scaleIn);
|
||||
}
|
||||
|
||||
if (fromCsys.valid())
|
||||
{
|
||||
Info<< " -from " << fromCsys().name() << endl;
|
||||
tmp<pointField> tpf = fromCsys().localPosition(surf.points());
|
||||
Info<< "move points from coordinate system: "
|
||||
<< fromCsys->name() << endl;
|
||||
tmp<pointField> tpf = fromCsys->localPosition(surf.points());
|
||||
surf.movePoints(tpf());
|
||||
}
|
||||
|
||||
if (toCsys.valid())
|
||||
{
|
||||
Info<< " -to " << toCsys().name() << endl;
|
||||
tmp<pointField> tpf = toCsys().globalPosition(surf.points());
|
||||
Info<< "move points to coordinate system: "
|
||||
<< toCsys->name() << endl;
|
||||
tmp<pointField> tpf = toCsys->globalPosition(surf.points());
|
||||
surf.movePoints(tpf());
|
||||
}
|
||||
|
||||
scalar scaleOut = 0;
|
||||
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||
{
|
||||
Info<< " -scaleOut " << scaleOut << endl;
|
||||
Info<< "scale output " << scaleOut << endl;
|
||||
surf.scalePoints(scaleOut);
|
||||
}
|
||||
|
||||
|
||||
@ -67,6 +67,7 @@ Note
|
||||
|
||||
#include "MeshedSurfaces.H"
|
||||
#include "coordinateSystems.H"
|
||||
#include "cartesianCS.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -148,9 +149,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// get the coordinate transformations
|
||||
autoPtr<coordinateSystem> fromCsys;
|
||||
autoPtr<coordinateSystem> toCsys;
|
||||
// The coordinate transformations (must be cartesian)
|
||||
autoPtr<coordSystem::cartesian> fromCsys;
|
||||
autoPtr<coordSystem::cartesian> toCsys;
|
||||
|
||||
if (args.found("from") || args.found("to"))
|
||||
{
|
||||
@ -175,51 +176,52 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
coordinateSystems csLst(ioCsys);
|
||||
coordinateSystems globalCoords(ioCsys);
|
||||
|
||||
if (args.found("from"))
|
||||
{
|
||||
const word csName = args["from"];
|
||||
const word csName(args["from"]);
|
||||
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||
|
||||
const label csIndex = csLst.findIndex(csName);
|
||||
if (csIndex < 0)
|
||||
if (!csPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find -from " << csName << nl
|
||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
||||
<< "available coordinateSystems: "
|
||||
<< flatOutput(globalCoords.names()) << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
fromCsys.reset(new coordinateSystem(csLst[csIndex]));
|
||||
fromCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||
}
|
||||
|
||||
if (args.found("to"))
|
||||
{
|
||||
const word csName = args["to"];
|
||||
const word csName(args["to"]);
|
||||
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||
|
||||
const label csIndex = csLst.findIndex(csName);
|
||||
if (csIndex < 0)
|
||||
if (!csPtr)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find -to " << csName << nl
|
||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
||||
<< "available coordinateSystems: "
|
||||
<< flatOutput(globalCoords.names()) << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
toCsys.reset(new coordinateSystem(csLst[csIndex]));
|
||||
toCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||
}
|
||||
|
||||
|
||||
// maybe fix this later
|
||||
if (fromCsys.valid() && toCsys.valid())
|
||||
// Maybe fix this later
|
||||
if (fromCsys && toCsys)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Only allowed '-from' or '-to' option at the moment."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
MeshedSurface<face> surf(importName);
|
||||
|
||||
if (args.found("clean"))
|
||||
@ -231,28 +233,30 @@ int main(int argc, char *argv[])
|
||||
scalar scaleIn = 0;
|
||||
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||
{
|
||||
Info<< " -scaleIn " << scaleIn << endl;
|
||||
Info<< "scale input " << scaleIn << endl;
|
||||
surf.scalePoints(scaleIn);
|
||||
}
|
||||
|
||||
if (fromCsys.valid())
|
||||
if (fromCsys)
|
||||
{
|
||||
Info<< " -from " << fromCsys().name() << endl;
|
||||
tmp<pointField> tpf = fromCsys().localPosition(surf.points());
|
||||
Info<< "move points from coordinate system: "
|
||||
<< fromCsys->name() << endl;
|
||||
tmp<pointField> tpf = fromCsys->localPosition(surf.points());
|
||||
surf.movePoints(tpf());
|
||||
}
|
||||
|
||||
if (toCsys.valid())
|
||||
if (toCsys)
|
||||
{
|
||||
Info<< " -to " << toCsys().name() << endl;
|
||||
tmp<pointField> tpf = toCsys().globalPosition(surf.points());
|
||||
Info<< "move points to coordinate system: "
|
||||
<< toCsys->name() << endl;
|
||||
tmp<pointField> tpf = toCsys->globalPosition(surf.points());
|
||||
surf.movePoints(tpf());
|
||||
}
|
||||
|
||||
scalar scaleOut = 0;
|
||||
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||
{
|
||||
Info<< " -scaleOut " << scaleOut << endl;
|
||||
Info<< "scale output " << scaleOut << endl;
|
||||
surf.scalePoints(scaleOut);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user