- in continuation of #2565 (rotationCentre for surface output formats) it is helpful to also support READ_IF_PRESENT behaviour for the 'origin' keyword. This can be safely used wherever the coordinate system definition is embedded within a sub-dictionary scope. Eg, dict1 { coordinateSystem { origin (0 0 0); // now optional here rotation ...; } } but remains mandatory if constructed without a sub-dict: dict2 { origin (0 0 0); // still mandatory e1 (1 0 0); e3 (0 0 1); } With this change, the "transform" sub-dictionary can written more naturally: formatOptions { vtk { scale 1000; // m -> mm transform { rotationCentre (1 0 0); rotation axisAngle; axis (0 0 1); angle -45; } } } ENH: simplify handling of "coordinateSystem" dictionary lookups - coordinateSystems::NewIfPresent method for optional entries: coordSysPtr_ = coordinateSystem::NewIfPresent(mesh, dict); Instead of if (dict.found(coordinateSystem::typeName, keyType::LITERAL)) { coordSysPtr_ = coordinateSystem::New ( mesh_, dict, coordinateSystem::typeName ); } else { coordSysPtr_.reset(); } ENH: more consistent handling of priorities for binModels, forces (#2598) - if the dictionaries are overspecified, give a 'coordinateSystem' entry a higher prioriy than the 'CofR' shortcuts. Was previously slightly inconsistent between the different models.
186 lines
3.1 KiB
C++
186 lines
3.1 KiB
C++
/*--------------------------------*- C++ -*----------------------------------*\
|
|
| ========= | |
|
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
|
| \\ / O peration | Version: v2206 |
|
|
| \\ / A nd | Website: www.openfoam.com |
|
|
| \\/ M anipulation | |
|
|
\*---------------------------------------------------------------------------*/
|
|
FoamFile
|
|
{
|
|
version 2.0;
|
|
format ascii;
|
|
class dictionary;
|
|
object testCsys1;
|
|
}
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
// Rotate 90 deg around x: y -> z, z -> -y
|
|
|
|
rot_x90
|
|
{
|
|
origin (0 0 0);
|
|
e1 (1 0 0);
|
|
e3 (0 -1 0);
|
|
}
|
|
|
|
rot_x90_axesRotation
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type axesRotation;
|
|
e1 (1 0 0);
|
|
e3 (0 -1 0);
|
|
}
|
|
}
|
|
|
|
rot_x90_axisAngle
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type axisAngle;
|
|
axis (1 0 0); // non-unit also OK
|
|
angle 90;
|
|
}
|
|
}
|
|
|
|
rot_x90_euler
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type euler;
|
|
angles (0 90 0); // z-x'-z''
|
|
}
|
|
}
|
|
|
|
|
|
// Rotate 45 deg around z: x -> (1 1 0), y = (-1 1 0)
|
|
|
|
rot_z45_axesRotation
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type axesRotation;
|
|
e1 (1 1 0);
|
|
e3 (0 0 1);
|
|
}
|
|
}
|
|
|
|
rot_z45_axisAngle
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type axisAngle;
|
|
axis (0 0 10); // non-unit also OK
|
|
angle 45;
|
|
}
|
|
}
|
|
|
|
rot_z45_euler
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type euler;
|
|
angles (45 0 0); // z-x'-z''
|
|
}
|
|
}
|
|
|
|
rot_z45_starcd
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type starcd;
|
|
angles (45 0 0); // z-x'-y''
|
|
}
|
|
}
|
|
|
|
|
|
// Rotate -45 deg around z: x -> (1 -1 0), y = (1 1 0)
|
|
|
|
rot_zm45_axesRotation
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type axesRotation;
|
|
e1 (1 -1 0);
|
|
e3 (0 0 1);
|
|
}
|
|
}
|
|
|
|
rot_zm45_axisAngle
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type axisAngle;
|
|
axis (0 0 10); // non-unit also OK
|
|
angle -45;
|
|
}
|
|
}
|
|
|
|
rot_zm45_euler
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type euler;
|
|
angles (-45 0 0); // z-x'-z''
|
|
}
|
|
}
|
|
|
|
|
|
// Null transforms
|
|
|
|
null_axesRotation
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type axesRotation;
|
|
e1 (1 0 0);
|
|
e3 (0 0 1);
|
|
}
|
|
}
|
|
|
|
null_axisAngle0
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type axisAngle;
|
|
axis (0 0 0); // non-unit also OK
|
|
angle 0;
|
|
}
|
|
}
|
|
|
|
null_axisAngle1
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type axisAngle;
|
|
axis (1 1 1); // non-unit also OK
|
|
angle 0;
|
|
}
|
|
}
|
|
|
|
null_euler
|
|
{
|
|
origin (0 0 0);
|
|
rotation
|
|
{
|
|
type euler;
|
|
angles (0 0 0); // z-x'-z''
|
|
}
|
|
}
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|