Commit dd2b8a82 authored by mattijs's avatar mattijs
Browse files

Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

parents 0178f8cd c0b236ec
......@@ -155,7 +155,9 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
:
motionState_(),
restraints_(),
restraintNames_(),
constraints_(),
constraintNames_(),
maxConstraintIterations_(0),
refCentreOfMass_(vector::zero),
momentOfInertia_(diagTensor::one*VSMALL),
......@@ -188,7 +190,9 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
tau
),
restraints_(),
restraintNames_(),
constraints_(),
constraintNames_(),
maxConstraintIterations_(0),
refCentreOfMass_(refCentreOfMass),
momentOfInertia_(momentOfInertia),
......@@ -201,7 +205,9 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict)
:
motionState_(dict),
restraints_(),
restraintNames_(),
constraints_(),
constraintNames_(),
maxConstraintIterations_(0),
refCentreOfMass_(dict.lookupOrDefault("refCentreOfMass", centreOfMass())),
momentOfInertia_(dict.lookup("momentOfInertia")),
......@@ -221,7 +227,9 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
:
motionState_(sDoFRBM.motionState()),
restraints_(sDoFRBM.restraints()),
restraintNames_(sDoFRBM.restraintNames()),
constraints_(sDoFRBM.constraints()),
constraintNames_(sDoFRBM.constraintNames()),
maxConstraintIterations_(sDoFRBM.maxConstraintIterations()),
refCentreOfMass_(sDoFRBM.refCentreOfMass()),
momentOfInertia_(sDoFRBM.momentOfInertia()),
......@@ -251,23 +259,29 @@ void Foam::sixDoFRigidBodyMotion::addRestraints
restraints_.setSize(restraintDict.size());
restraintNames_.setSize(restraintDict.size());
forAllConstIter(IDLList<entry>, restraintDict, iter)
{
if (iter().isDict())
{
Info<< "Adding restraint: " << iter().keyword() << endl;
// Info<< "Adding restraint: " << iter().keyword() << endl;
restraints_.set
(
i,
sixDoFRigidBodyMotionRestraint::New(iter().dict())
);
}
i++;
restraintNames_[i] = iter().keyword();
i++;
}
}
restraints_.setSize(i);
restraintNames_.setSize(i);
}
}
......@@ -285,25 +299,33 @@ void Foam::sixDoFRigidBodyMotion::addConstraints
constraints_.setSize(constraintDict.size());
constraintNames_.setSize(constraintDict.size());
forAllConstIter(IDLList<entry>, constraintDict, iter)
{
if (iter().isDict())
{
Info<< "Adding constraint: " << iter().keyword() << endl;
// Info<< "Adding constraint: " << iter().keyword() << endl;
constraints_.set
(
i++,
i,
sixDoFRigidBodyMotionConstraint::New(iter().dict())
);
constraintNames_[i] = iter().keyword();
i++;
}
}
constraints_.setSize(i);
if (constraints_.size())
constraintNames_.setSize(i);
if (!constraints_.empty())
{
maxConstraintIters_ = readLabel
maxConstraintIterations_ = readLabel
(
constraintDict.lookup("maxIterations")
);
......
......@@ -91,9 +91,15 @@ class sixDoFRigidBodyMotion
//- Restraints on the motion
PtrList<sixDoFRigidBodyMotionRestraint> restraints_;
//- Names of the restraints
wordList restraintNames_;
//- Constaints on the motion
PtrList<sixDoFRigidBodyMotionConstraint> constraints_;
//- Names of the constraints
wordList constraintNames_;
//- Maximum number of iterations allowed to attempt to obey
// constraints
label maxConstraintIterations_;
......@@ -146,10 +152,16 @@ class sixDoFRigidBodyMotion
inline const PtrList<sixDoFRigidBodyMotionRestraint>&
restraints() const;
//- Return access to the restraintNames
inline const wordList& restraintNames() const;
//- Return access to the constraints
inline const PtrList<sixDoFRigidBodyMotionConstraint>&
constraints() const;
//- Return access to the constraintNames
inline const wordList& constraintNames() const;
//- Return access to the maximum allowed number of
// constraint iterations
inline label maxConstraintIterations() const;
......
......@@ -34,8 +34,8 @@ Foam::sixDoFRigidBodyMotionConstraint::New(const dictionary& sDoFRBMCDict)
word sixDoFRigidBodyMotionConstraintTypeName =
sDoFRBMCDict.lookup("sixDoFRigidBodyMotionConstraint");
Info<< "Selecting sixDoFRigidBodyMotionConstraint function "
<< sixDoFRigidBodyMotionConstraintTypeName << endl;
// Info<< "Selecting sixDoFRigidBodyMotionConstraint function "
// << sixDoFRigidBodyMotionConstraintTypeName << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find
......
......@@ -107,6 +107,12 @@ Foam::sixDoFRigidBodyMotion::restraints() const
}
inline const Foam::wordList& Foam::sixDoFRigidBodyMotion::restraintNames() const
{
return restraintNames_;
}
inline const Foam::PtrList<Foam::sixDoFRigidBodyMotionConstraint>&
Foam::sixDoFRigidBodyMotion::constraints() const
{
......@@ -114,6 +120,13 @@ Foam::sixDoFRigidBodyMotion::constraints() const
}
inline const Foam::wordList&
Foam::sixDoFRigidBodyMotion::constraintNames() const
{
return constraintNames_;
}
inline Foam::label Foam::sixDoFRigidBodyMotion::maxConstraintIterations() const
{
return maxConstraintIterations_;
......
......@@ -69,7 +69,7 @@ void Foam::sixDoFRigidBodyMotion::write(Ostream& os) const
{
dictionary constraintsDict;
constraintsDict.add("maxIterations", maxConstraintIters_);
constraintsDict.add("maxIterations", maxConstraintIterations_);
forAll(constraints_, rI)
{
......
......@@ -34,8 +34,8 @@ Foam::sixDoFRigidBodyMotionRestraint::New(const dictionary& sDoFRBMRDict)
word sixDoFRigidBodyMotionRestraintTypeName =
sDoFRBMRDict.lookup("sixDoFRigidBodyMotionRestraint");
Info<< "Selecting sixDoFRigidBodyMotionRestraint function "
<< sixDoFRigidBodyMotionRestraintTypeName << endl;
// Info<< "Selecting sixDoFRigidBodyMotionRestraint function "
// << sixDoFRigidBodyMotionRestraintTypeName << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment