meshTools/coordinateSystems cosmetic cleanup

This commit is contained in:
Mark Olesen
2008-08-07 11:05:28 +02:00
parent f5e73da8aa
commit fd7dcffd50
4 changed files with 7 additions and 125 deletions

View File

@ -1,103 +0,0 @@
ALL FILES:
* construct null
* allow assignment of name/origin
* MAJOR CHANGE
- a point is a vector, but not vice versa
- previous methods toGlobal/toLocal include the origin translation
which is incorrect for vectors
- new methods with explicit names:
globalPosition, globalVector, relativePosition, relativeVector
* change affects:
finiteVolume/fields/fvPatchFields/derivedFvPatchFields/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C
utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C
------------------------
coordinateRotation.C
coordinateRotation.H
* coordinateRotation is a tensor with restricted contructors
* null contructor yields the global coordinate system
* a null dictionary corresponds to a null constructor
* new axis/direction constructor with functionality taken from
porousZone and previous coordinateSystem implementation
* allow any combination (e1/e2), (e2/e3), (e3,e1) of local vectors
in addition to the axis/direction specification.
- Added check for co-linear axes.
- Could possibly eliminate the non-orthogonality check.
* allow assigment from dictionary, automatically descend in a
'coordinateRotation' sub-dictionary
* add hook in New() for type 'coordinateRotation' with alias 'axes'
------------------------
coordinateSystem.C
coordinateSystem.H
* remove pure virtual restriction - coordinateSystem can be used
directly and has the same properties as a cartesianCS
* null contructor yields the global coordinate system
* a null dictionary entry corresponds to the global coordinate system
* dictionary constructor w/o name uses the typeName
* the coordinateSystem now has a coordinateRotation,
use coordinateRotation constructors instead of calculating any
rotations ourselves
* allow assigment from dictionary, automatically descend into a
'coordinateSystem' sub-dictionary
This simplifies the addition to other dictionary constructors
(eg, porousZone) without requiring a flat structure or special
parsing within the constructor.
eg,
Foam::porousZone::porousZone(const fvMesh& mesh, Istream& is)
:
mesh_(mesh),
name_(is),
dict_(is),
cellZoneID_(mesh_.cellZones().findZoneID(name_)),
csys_(dict_),
C0_(0),
C1_(0),
D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero),
F_("F", dimensionSet(0, -1, 0, 0, 0), tensor::zero)
{
...
}
* could consider eliminating Rtr_ member and just use R_.T() instead
* add hook in New() for type 'coordinateSystem'
------------------------
cartesianCS.C
cartesianCS.H
* eliminate redundant virtual functions
------------------------
cylindricalCS.H
* include coordinateSystem.H and not cartesianCS.H
------------------------
coordinateSystems.C
coordinateSystems.H
* provide a means to access an invariant set of coordinate systems

View File

@ -210,25 +210,19 @@ void Foam::coordinateRotation::operator=(const dictionary& rhs)
);
vector axis1, axis2;
axisOrder order = e3e1;
axisOrder order(e3e1);
if (dict.found("e1") && dict.found("e2"))
if (dict.readIfPresent("e1", axis1) && dict.readIfPresent("e2", axis2))
{
order = e1e2;
dict.lookup("e1") >> axis1;
dict.lookup("e2") >> axis2;
}
else if (dict.found("e2") && dict.found("e3"))
else if (dict.readIfPresent("e2", axis1) && dict.readIfPresent("e3", axis2))
{
order = e2e3;
dict.lookup("e2") >> axis1;
dict.lookup("e3") >> axis2;
}
else if (dict.found("e3") && dict.found("e1"))
else if (dict.readIfPresent("e3", axis1) && dict.readIfPresent("e1", axis2))
{
order = e3e1;
dict.lookup("e3") >> axis1;
dict.lookup("e1") >> axis2;
}
else if (dict.found("axis") || dict.found("direction"))
{

View File

@ -267,14 +267,8 @@ void Foam::coordinateSystem::operator=(const dictionary& rhs)
);
// unspecified origin is (0 0 0)
if (dict.found("origin"))
{
dict.lookup("origin") >> origin_;
}
else
{
origin_ = vector::zero;
}
origin_ = vector::zero;
dict.readIfPresent("origin", origin_);
// specify via coordinateRotation
if (dict.found("coordinateRotation"))

View File

@ -117,10 +117,7 @@ Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
// default type is self
word coordType(typeName_());
if (dict.found("type"))
{
dict.lookup("type") >> coordType;
}
dict.readIfPresent("type", coordType);
// can (must) construct base class directly
if (coordType == typeName_())