/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2009-2010 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 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 . Class Foam::DynamicField Description Dynamically sized Field. WIP. SourceFiles DynamicField.C \*---------------------------------------------------------------------------*/ #ifndef DynamicField_H #define DynamicField_H #include "Field.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // Forward declaration of friend functions and operators template class DynamicField; template Ostream& operator<<(Ostream&, const DynamicField&); template Ostream& operator<<(Ostream&, const tmp >&); template Istream& operator>>(Istream&, DynamicField&); /*---------------------------------------------------------------------------*\ Class DynamicField Declaration \*---------------------------------------------------------------------------*/ template class DynamicField : public Field { // Private data //- The capacity (allocated size) of the underlying field. label capacity_; //- Construct given size and initial value DynamicField(const label, const Type&); //- Construct as copy of tmp # ifdef ConstructFromTmp DynamicField(const tmp >&); # endif //- Construct from a dictionary entry DynamicField(const word&, const dictionary&, const label); public: // Static data members static const char* const typeName; // Static Member Functions //- Return a null field inline static const DynamicField& null() { return *reinterpret_cast< DynamicField* >(0); } // Constructors //- Construct null // Used for temporary fields which are initialised after construction DynamicField(); //- Construct given size // Used for temporary fields which are initialised after construction explicit inline DynamicField(const label); //- Construct as copy of a UList\ explicit inline DynamicField(const UList&); //- Construct by transferring the List contents explicit inline DynamicField(const Xfer >&); //- Construct by 1 to 1 mapping from the given field inline DynamicField ( const UList& mapF, const labelList& mapAddressing ); //- Construct by interpolative mapping from the given field inline DynamicField ( const UList& mapF, const labelListList& mapAddressing, const scalarListList& weights ); //- Construct by mapping from the given field inline DynamicField ( const UList& mapF, const FieldMapper& map ); //- Construct as copy inline DynamicField(const DynamicField&); //- Construct as copy or re-use as specified. inline DynamicField(DynamicField&, bool reUse); //- Construct by transferring the Field contents inline DynamicField(const Xfer >&); //- Construct from Istream inline DynamicField(Istream&); //- Clone tmp > clone() const; // Member Functions //- Size of the underlying storage. inline label capacity() const; //- Append an element at the end of the list inline void append(const Type&); //- Alter the addressed list size. // New space will be allocated if required. // Use this to resize the list prior to using the operator[] for // setting values (as per List usage). void setSize(const label nElem); // Member operators inline void operator=(const DynamicField&); inline void operator=(const UList&); inline void operator=(const tmp >&); //- Return element of Field. using Field::operator[]; // IOstream operators friend Ostream& operator<< (Ostream&, const DynamicField&); friend Ostream& operator<< (Ostream&, const tmp >&); friend Istream& operator>> (Istream&, DynamicField&); }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "DynamicFieldI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository # include "DynamicField.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* //