Commit d9c7c671 authored by Henry Weller's avatar Henry Weller
Browse files

Function1: Simplified files

parent 0431d4e6
......@@ -259,9 +259,43 @@ const Foam::fileName& Foam::Function1Types::CSV<Type>::fName() const
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "CSVIO.C"
template<class Type>
void Foam::Function1Types::CSV<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << token::END_STATEMENT << nl;
os << indent << word(this->name() + "Coeffs") << nl;
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
// Note: for TableBase write the dictionary entries it needs but not
// the values themselves
TableBase<Type>::writeEntries(os);
os.writeKeyword("nHeaderLine") << nHeaderLine_ << token::END_STATEMENT
<< nl;
os.writeKeyword("refColumn") << refColumn_ << token::END_STATEMENT << nl;
// Force writing labelList in ascii
os.writeKeyword("componentColumns");
if (os.format() == IOstream::BINARY)
{
os.format(IOstream::ASCII);
os << componentColumns_;
os.format(IOstream::BINARY);
}
else
{
os << componentColumns_;
}
os << token::END_STATEMENT << nl;
os.writeKeyword("separator") << string(separator_)
<< token::END_STATEMENT << nl;
os.writeKeyword("mergeSeparators") << mergeSeparators_
<< token::END_STATEMENT << nl;
os.writeKeyword("fileName") << fName_ << token::END_STATEMENT << nl;
os << decrIndent << indent << token::END_BLOCK << endl;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Function1.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
void Foam::Function1Types::CSV<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << token::END_STATEMENT << nl;
os << indent << word(this->name() + "Coeffs") << nl;
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
// Note: for TableBase write the dictionary entries it needs but not
// the values themselves
TableBase<Type>::writeEntries(os);
os.writeKeyword("nHeaderLine") << nHeaderLine_ << token::END_STATEMENT
<< nl;
os.writeKeyword("refColumn") << refColumn_ << token::END_STATEMENT << nl;
// Force writing labelList in ascii
os.writeKeyword("componentColumns");
if (os.format() == IOstream::BINARY)
{
os.format(IOstream::ASCII);
os << componentColumns_;
os.format(IOstream::BINARY);
}
else
{
os << componentColumns_;
}
os << token::END_STATEMENT << nl;
os.writeKeyword("separator") << string(separator_)
<< token::END_STATEMENT << nl;
os.writeKeyword("mergeSeparators") << mergeSeparators_
<< token::END_STATEMENT << nl;
os.writeKeyword("fileName") << fName_ << token::END_STATEMENT << nl;
os << decrIndent << indent << token::END_BLOCK << endl;
}
// ************************************************************************* //
......@@ -90,8 +90,13 @@ Type Foam::Function1Types::Constant<Type>::integrate
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
template<class Type>
void Foam::Function1Types::Constant<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << token::SPACE << value_ << token::END_STATEMENT << nl;
}
#include "ConstantIO.C"
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Constant.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
void Foam::Function1Types::Constant<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << token::SPACE << value_ << token::END_STATEMENT << nl;
}
// ************************************************************************* //
......@@ -120,8 +120,33 @@ Foam::tmp<Foam::Field<Type>> Foam::Function1<Type>::integrate
}
template<class Type>
void Foam::Function1<Type>::writeData(Ostream& os) const
{
os.writeKeyword(name_) << type();
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "Function1IO.C"
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Function1<Type>& f1
)
{
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const Function1<Type>&)"
);
os << f1.name_;
f1.writeData(os);
return os;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Function1.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Function1<Type>& f1
)
{
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const Function1<Type>&)"
);
os << f1.name_;
f1.writeData(os);
return os;
}
template<class Type>
void Foam::Function1<Type>::writeData(Ostream& os) const
{
os.writeKeyword(name_) << type();
}
// ************************************************************************* //
......@@ -198,8 +198,13 @@ Type Foam::Function1Types::Polynomial<Type>::integrate
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
template<class Type>
void Foam::Function1Types::Polynomial<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << nl << indent << coeffs_ << token::END_STATEMENT << nl;
}
#include "PolynomialEntryIO.C"
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "PolynomialEntry.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
void Foam::Function1Types::Polynomial<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << nl << indent << coeffs_ << token::END_STATEMENT << nl;
}
// ************************************************************************* //
......@@ -97,8 +97,20 @@ Type Foam::Function1Types::Sine<Type>::integrate
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
template<class Type>
void Foam::Function1Types::Sine<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << token::END_STATEMENT << nl;
os << indent << word(this->name() + "Coeffs") << nl;
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("t0") << t0_ << token::END_STATEMENT << nl;
amplitude_->writeData(os);
frequency_->writeData(os);
scale_->writeData(os);
level_->writeData(os);
os << decrIndent << indent << token::END_BLOCK << endl;
}
#include "SineIO.C"
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Sine.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
void Foam::Function1Types::Sine<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << token::END_STATEMENT << nl;
os << indent << word(this->name() + "Coeffs") << nl;
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("t0") << t0_ << token::END_STATEMENT << nl;
amplitude_->writeData(os);
frequency_->writeData(os);
scale_->writeData(os);
level_->writeData(os);
os << decrIndent << indent << token::END_BLOCK << endl;
}
// ************************************************************************* //
......@@ -406,8 +406,29 @@ Foam::tmp<Foam::Field<Type>> Foam::Function1Types::TableBase<Type>::y() const
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
template<class Type>
void Foam::Function1Types::TableBase<Type>::writeEntries(Ostream& os) const
{
if (boundsHandling_ != CLAMP)
{
os.writeKeyword("outOfBounds") << boundsHandlingToWord(boundsHandling_)
<< token::END_STATEMENT << nl;
}
if (interpolationScheme_ != "linear")
{
os.writeKeyword("interpolationScheme") << interpolationScheme_
<< token::END_STATEMENT << nl;
}
}
template<class Type>
void Foam::Function1Types::TableBase<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << nl << indent << table_ << token::END_STATEMENT << nl;
writeEntries(os);
}
#include "TableBaseIO.C"
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Function1.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
void Foam::Function1Types::TableBase<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << nl << indent << table_ << token::END_STATEMENT << nl;
writeEntries(os);
}
template<class Type>
void Foam::Function1Types::TableBase<Type>::writeEntries(Ostream& os) const
{
if (boundsHandling_ != CLAMP)
{
os.writeKeyword("outOfBounds") << boundsHandlingToWord(boundsHandling_)
<< token::END_STATEMENT << nl;
}
if (interpolationScheme_ != "linear")
{
os.writeKeyword("interpolationScheme") << interpolationScheme_
<< token::END_STATEMENT << nl;
}
}
// ************************************************************************* //
......@@ -72,8 +72,24 @@ Foam::Function1Types::TableFile<Type>::~TableFile()
{}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::Function1Types::TableFile<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << token::END_STATEMENT << nl
<< indent << word(this->name() + "Coeffs") << nl
<< indent << token::BEGIN_BLOCK << nl << incrIndent;
// Note: for TableBase write the dictionary entries it needs but not
// the values themselves
TableBase<Type>::writeEntries(os);
os.writeKeyword("fileName")<< fName_ << token::END_STATEMENT << nl;
os << decrIndent << indent << token::END_BLOCK << endl;
}
#include "TableFileIO.C"
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Function1.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
void Foam::Function1Types::TableFile<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << token::END_STATEMENT << nl
<< indent << word(this->name() + "Coeffs") << nl
<< indent << token::BEGIN_BLOCK << nl << incrIndent;
// Note: for TableBase write the dictionary entries it needs but not
// the values themselves
TableBase<Type>::writeEntries(os);
os.writeKeyword("fileName")<< fName_ << token::END_STATEMENT << nl;
os << decrIndent << indent << token::END_BLOCK << endl;
}
// ************************************************************************* //
Markdown is supported
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