Fixed output of constraints for proper restart

This commit is contained in:
Vuko Vukcevic 2017-03-08 08:06:09 +01:00 committed by Hrvoje Jasak
parent bd820ac31b
commit 40f7e0a3d1
12 changed files with 141 additions and 9 deletions

View file

@ -20,6 +20,7 @@ $(sixDOF)/constraints/rotationalConstraints/rotationalConstraint/rotationalConst
$(sixDOF)/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.C
$(sixDOF)/constraints/translationalConstraints/translationalConstraint/translationalConstraint.C
$(sixDOF)/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.C
$(sixDOF)/sixDOFODE/sixDOFODE.C
$(sixDOF)/sixDOFODE/newSixDOFODE.C

View file

@ -105,4 +105,18 @@ Foam::scalar Foam::constantAngularAcceleration::sourceContribution
}
void Foam::constantAngularAcceleration::write(Ostream& os) const
{
os.writeKeyword("type") << tab << type()
<< token::END_STATEMENT << nl << nl;
os.writeKeyword("constraintDirection") << tab << dir_
<< token::END_STATEMENT << nl;
os.writeKeyword("angularAcceleration") << tab << alpha_
<< token::END_STATEMENT << nl;
os.writeKeyword("inGlobalCoordinateSystem") << tab << inGlobal_
<< token::END_STATEMENT << endl;
}
// ************************************************************************* //

View file

@ -106,6 +106,12 @@ public:
//- Return source contribution defined by constraint, a(t)
virtual scalar sourceContribution(const scalar) const;
// I-O Functions
//- Virtual write function
virtual void write(Ostream& os) const;
};

View file

@ -40,6 +40,8 @@ Foam::rotationalConstraint::rotationalConstraint
const word& name,
const dictionary& dict
)
:
name_(name)
{}
@ -89,4 +91,24 @@ Foam::autoPtr<Foam::rotationalConstraint> Foam::rotationalConstraint::New
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const rotationalConstraint& rc
)
{
os << rc.name_ << nl << token::BEGIN_BLOCK << nl;
rc.write(os);
os << token::END_BLOCK << endl;
os.check("Ostream& operator<<(Ostream&, const rotationalConstraint&");
return os;
}
// ************************************************************************* //

View file

@ -69,6 +69,12 @@ namespace Foam
class rotationalConstraint
{
// Private Data
//- Name of the constraint
word name_;
public:
//- Runtime type information
@ -149,6 +155,19 @@ public:
//- Return source contribution defined by constraint, a(t)
virtual scalar sourceContribution(const scalar t) const = 0;
// I-O Functions and Operators
//- Virtual write function
virtual void write(Ostream& os) const = 0;
//- Ostream operator implemented in terms of write operator
friend Ostream& operator<<
(
Ostream& os,
const rotationalConstraint& rc
);
};

View file

@ -90,4 +90,16 @@ Foam::scalar Foam::constantTranslationalAcceleration::sourceContribution
}
void Foam::constantTranslationalAcceleration::write(Ostream& os) const
{
os.writeKeyword("type") << tab << type()
<< token::END_STATEMENT << nl << nl;
os.writeKeyword("constraintDirection") << tab << dir_
<< token::END_STATEMENT << nl;
os.writeKeyword("translationalAcceleration") << tab << a_
<< token::END_STATEMENT << endl;
}
// ************************************************************************* //

View file

@ -102,6 +102,12 @@ public:
//- Return source contribution defined by constraint, a(t)
virtual scalar sourceContribution(const scalar) const;
// I-O Functions
//- Virtual write function
virtual void write(Ostream& os) const;
};

View file

@ -40,6 +40,8 @@ Foam::translationalConstraint::translationalConstraint
const word& name,
const dictionary& dict
)
:
name_(name)
{}
@ -89,4 +91,24 @@ Foam::autoPtr<Foam::translationalConstraint> Foam::translationalConstraint::New
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const translationalConstraint& tc
)
{
os << tc.name_ << nl << token::BEGIN_BLOCK << nl;
tc.write(os);
os << token::END_BLOCK << endl;
os.check("Ostream& operator<<(Ostream&, const translationalConstraint&");
return os;
}
// ************************************************************************* //

View file

@ -69,6 +69,12 @@ namespace Foam
class translationalConstraint
{
// Private Data
//- Name of the constraint
word name_;
public:
//- Runtime type information
@ -149,6 +155,19 @@ public:
//- Return source contribution defined by constraint, a(t)
virtual scalar sourceContribution(const scalar t) const = 0;
// I-O Functions and Operators
//- Virtual write function
virtual void write(Ostream& os) const = 0;
//- Ostream operator implemented in terms of write operator
friend Ostream& operator<<
(
Ostream& os,
const translationalConstraint& tc
);
};

View file

@ -613,7 +613,8 @@ bool Foam::geometricSixDOF::writeData(Ostream& os) const
sixDOFODE::writeData(os);
// Write type name
os.writeKeyword("type") << tab << type() << token::END_STATEMENT << endl;
os.writeKeyword("type") << tab << type()
<< token::END_STATEMENT << nl << nl;
// Write data
os.writeKeyword("Xrel") << tab << Xrel_
@ -624,12 +625,21 @@ bool Foam::geometricSixDOF::writeData(Ostream& os) const
os.writeKeyword("rotationIncrementTensor") << tab << rotIncrement_
<< token::END_STATEMENT << nl;
os.writeKeyword("omega") << tab << omega_
<< token::END_STATEMENT << nl << nl;
<< token::END_STATEMENT << nl << endl;
// os.writeKeyword("translationalConstraints") << tab
// << translationalConstraints_ << token::END_STATEMENT << nl;
// os.writeKeyword("rotationalConstraints") << tab
// << rotationalConstraints_ << token::END_STATEMENT << nl << endl;
if (!translationalConstraints_.empty())
{
os.writeKeyword("translationalConstraints")
<< translationalConstraints_
<< token::END_STATEMENT << nl << endl;
}
if (!rotationalConstraints_.empty())
{
os.writeKeyword("rotationalConstraints")
<< rotationalConstraints_
<< token::END_STATEMENT << endl;
}
return os.good();
}

View file

@ -538,7 +538,8 @@ bool Foam::quaternionSixDOF::writeData(Ostream& os) const
sixDOFODE::writeData(os);
// Write type name
os.writeKeyword("type") << tab << type() << token::END_STATEMENT << endl;
os.writeKeyword("type") << tab << type()
<< token::END_STATEMENT << nl << nl;
// Write data
os.writeKeyword("Xrel") << tab << Xrel_

View file

@ -332,12 +332,12 @@ bool Foam::sixDOFODE::writeData(Ostream& os) const
os.writeKeyword("minRelaxFactor") << tab << minRelaxFactor_
<< token::END_STATEMENT << nl;
os.writeKeyword("maxRelaxFactor") << tab << maxRelaxFactor_
<< token::END_STATEMENT << nl;
<< token::END_STATEMENT << nl << nl;
os.writeKeyword("force") << tab << force_
<< token::END_STATEMENT << nl;
os.writeKeyword("moment") << tab << moment_
<< token::END_STATEMENT << nl;
<< token::END_STATEMENT << nl << nl;
return os.good();
}