diff --git a/applications/test/DynamicField/DynamicFieldTest.C b/applications/test/DynamicField/DynamicFieldTest.C index e78747fb0f..3e5a8dfc54 100644 --- a/applications/test/DynamicField/DynamicFieldTest.C +++ b/applications/test/DynamicField/DynamicFieldTest.C @@ -43,6 +43,9 @@ int main(int argc, char *argv[]) dl.append(2); dl.append(1); Pout<< "appending : dl:" << dl << endl; + + dl[2] *= 10; + Pout<< "assigning : dl:" << dl << endl; } { diff --git a/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H b/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H index a7715b245a..a464ac9d22 100644 --- a/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H +++ b/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -175,10 +175,7 @@ public: inline void operator=(const tmp >&); //- Return element of Field. - inline Type& operator[](const label i); - - //- Return element of constant Field. - inline const Type& operator[](const label) const; + using Field::operator[]; // IOstream operators diff --git a/src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldI.H b/src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldI.H index b48db15204..bc54c71fbd 100644 --- a/src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldI.H +++ b/src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,15 +25,10 @@ License #include "DynamicField.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -DynamicField::DynamicField() +Foam::DynamicField::DynamicField() : Field(), capacity_(0) @@ -41,7 +36,7 @@ DynamicField::DynamicField() template -DynamicField::DynamicField(const label size) +Foam::DynamicField::DynamicField(const label size) : Field(size), capacity_(Field::size()) @@ -73,7 +68,7 @@ inline Foam::DynamicField::DynamicField template -DynamicField::DynamicField +Foam::DynamicField::DynamicField ( const UList& mapF, const labelList& mapAddressing @@ -85,7 +80,7 @@ DynamicField::DynamicField template -DynamicField::DynamicField +Foam::DynamicField::DynamicField ( const UList& mapF, const labelListList& mapAddressing, @@ -99,7 +94,7 @@ DynamicField::DynamicField //- Construct by mapping from the given field template -DynamicField::DynamicField +Foam::DynamicField::DynamicField ( const UList& mapF, const FieldMapper& map @@ -111,7 +106,7 @@ DynamicField::DynamicField template -DynamicField::DynamicField(const DynamicField& f) +Foam::DynamicField::DynamicField(const DynamicField& f) : Field(f), capacity_(Field::size()) @@ -119,7 +114,7 @@ DynamicField::DynamicField(const DynamicField& f) template -DynamicField::DynamicField(DynamicField& f, bool reUse) +Foam::DynamicField::DynamicField(DynamicField& f, bool reUse) : Field(f, reUse), capacity_(Field::size()) @@ -127,7 +122,7 @@ DynamicField::DynamicField(DynamicField& f, bool reUse) template -DynamicField::DynamicField(const Xfer >& f) +Foam::DynamicField::DynamicField(const Xfer >& f) : Field(f), capacity_(Field::size()) @@ -137,14 +132,14 @@ DynamicField::DynamicField(const Xfer >& f) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -Foam::label DynamicField::capacity() const +Foam::label Foam::DynamicField::capacity() const { return capacity_; } template -void DynamicField::append(const Type& t) +void Foam::DynamicField::append(const Type& t) { label elemI = Field::size(); setSize(elemI + 1); @@ -156,7 +151,7 @@ void DynamicField::append(const Type& t) // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template -void DynamicField::operator=(const DynamicField& rhs) +void Foam::DynamicField::operator=(const DynamicField& rhs) { if (this == &rhs) { @@ -171,7 +166,7 @@ void DynamicField::operator=(const DynamicField& rhs) template -void DynamicField::operator=(const UList& rhs) +void Foam::DynamicField::operator=(const UList& rhs) { Field::operator=(rhs); capacity_ = Field::size(); @@ -179,7 +174,7 @@ void DynamicField::operator=(const UList& rhs) template -void DynamicField::operator=(const tmp& rhs) +void Foam::DynamicField::operator=(const tmp& rhs) { if (this == &(rhs())) { @@ -196,25 +191,7 @@ void DynamicField::operator=(const tmp& rhs) } -template -Type& DynamicField::operator[](const label i) -{ - return Field::operator[](i); -} - - -template -const Type& DynamicField::operator[](const label i) const -{ - return Field::operator[](i); -} - - // * * * * * * * * * * * * * * * IOstream Operator * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* //