diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 24208bfcd5fcd7b65fd0e9ac717da1f635113233..9d1daeeeef5649ebf8a7699d0a1a7db744e13ecd 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -449,7 +449,11 @@ meshTools = meshes/meshTools $(meshTools)/matchPoints.C $(meshTools)/mergePoints.C +fields/UniformDimensionedFields/uniformDimensionedFields.C +fields/cloud/cloud.C + Fields = fields/Fields + $(Fields)/labelField/labelField.C $(Fields)/scalarField/scalarField.C $(Fields)/sphericalTensorField/sphericalTensorField.C @@ -458,8 +462,6 @@ $(Fields)/symmTensorField/symmTensorField.C $(Fields)/tensorField/tensorField.C $(Fields)/complexFields/complexFields.C -fields/cloud/cloud.C - $(Fields)/labelField/labelIOField.C $(Fields)/scalarField/scalarIOField.C $(Fields)/vectorField/vectorIOField.C diff --git a/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.C b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.C new file mode 100644 index 0000000000000000000000000000000000000000..bcf5ddc58dc4f01a4b0ad94b20eb075cd016e96f --- /dev/null +++ b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.C @@ -0,0 +1,112 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "UniformDimensionedField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +Foam::UniformDimensionedField<Type>::UniformDimensionedField +( + const IOobject& io, + const dimensioned<Type>& dt +) +: + regIOobject(io), + dimensioned<Type>(dt) +{} + + +template<class Type> +Foam::UniformDimensionedField<Type>::UniformDimensionedField +( + const UniformDimensionedField<Type>& rdt +) +: + regIOobject(rdt), + dimensioned<Type>(rdt) +{} + + +template<class Type> +Foam::UniformDimensionedField<Type>::UniformDimensionedField +( + const IOobject& io +) +: + regIOobject(io), + dimensioned<Type>(regIOobject::name(), dimless, pTraits<Type>::zero) +{ + dictionary dict(readStream(typeName)); + this->dimensions().reset(dict.lookup("dimensions")); + this->value() = dict.lookup("value"); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class Type> +Foam::UniformDimensionedField<Type>::~UniformDimensionedField() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +bool Foam::UniformDimensionedField<Type>::writeData(Ostream& os) const +{ + os.writeKeyword("dimensions") << this->dimensions() << token::END_STATEMENT + << nl; + os.writeKeyword("value") << this->value() << token::END_STATEMENT + << nl << nl; + + return (os.good()); +} + + +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + +template<class Type> +void Foam::UniformDimensionedField<Type>::operator= +( + const UniformDimensionedField<Type>& rhs +) +{ + dimensioned<Type>::operator=(rhs); +} + + +template<class Type> +void Foam::UniformDimensionedField<Type>::operator= +( + const dimensioned<Type>& rhs +) +{ + dimensioned<Type>::operator=(rhs); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H new file mode 100644 index 0000000000000000000000000000000000000000..2d3ff83144a05e8be0692665a1361a9256361e9e --- /dev/null +++ b/src/OpenFOAM/fields/UniformDimensionedFields/UniformDimensionedField.H @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::UniformDimensionedField + +Description + Dimensioned<Type> registered with the database as a registered IOobject + which has the functionality of a uniform field and allows values from the + top-level code to be passed to boundary conditions etc. + +SourceFiles + UniformDimensionedField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef UniformDimensionedField_H +#define UniformDimensionedField_H + +#include "regIOobject.H" +#include "dimensionedType.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class UniformDimensionedField Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class UniformDimensionedField +: + public regIOobject, + public dimensioned<Type> +{ + +public: + + //- Runtime type information + TypeName("DimensionedType"); + + + // Constructors + + //- Construct null + UniformDimensionedField(); + + //- Construct from components + UniformDimensionedField(const IOobject&, const dimensioned<Type>&); + + //- Construct as copy + UniformDimensionedField(const UniformDimensionedField<Type>&); + + //- Construct from Istream + UniformDimensionedField(const IOobject&); + + + //- Destructor + virtual ~UniformDimensionedField(); + + + // Member Functions + + //- Name function provided to resolve the ambiguity between the + // name functions in regIOobject and dimensioned<Type> + virtual const word& name() const + { + return dimensioned<Type>::name(); + } + + bool writeData(Ostream&) const; + + + // Member Operators + + void operator=(const UniformDimensionedField<Type>&); + void operator=(const dimensioned<Type>&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "UniformDimensionedField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/UniformDimensionedFields/uniformDimensionedFields.C b/src/OpenFOAM/fields/UniformDimensionedFields/uniformDimensionedFields.C new file mode 100644 index 0000000000000000000000000000000000000000..07ea575bbec1c29063404c7d09f155b4dbe4ad93 --- /dev/null +++ b/src/OpenFOAM/fields/UniformDimensionedFields/uniformDimensionedFields.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "uniformDimensionedFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTemplateTypeNameAndDebug(uniformDimensionedScalarField, 0); +defineTemplateTypeNameAndDebug(uniformDimensionedVectorField, 0); +defineTemplateTypeNameAndDebug(uniformDimensionedSphericalTensorField, 0); +defineTemplateTypeNameAndDebug(uniformDimensionedSymmTensorField, 0); +defineTemplateTypeNameAndDebug(uniformDimensionedTensorField, 0); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/fields/UniformDimensionedFields/uniformDimensionedFields.H b/src/OpenFOAM/fields/UniformDimensionedFields/uniformDimensionedFields.H new file mode 100644 index 0000000000000000000000000000000000000000..a59298e8d7ad15439459e8bada5f0815694be61e --- /dev/null +++ b/src/OpenFOAM/fields/UniformDimensionedFields/uniformDimensionedFields.H @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +InClass + Foam::UniformDimensionedField + +Description + +SourceFiles + UniformDimensionedFields.C + +\*---------------------------------------------------------------------------*/ + +#ifndef UniformDimensionedFields_H +#define UniformDimensionedFields_H + +#include "UniformDimensionedField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +typedef UniformDimensionedField<scalar> uniformDimensionedScalarField; +typedef UniformDimensionedField<vector> uniformDimensionedVectorField; +typedef UniformDimensionedField<sphericalTensor> uniformDimensionedSphericalTensorField; +typedef UniformDimensionedField<symmTensor> uniformDimensionedSymmTensorField; +typedef UniformDimensionedField<tensor> uniformDimensionedTensorField; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //