diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index 334eba8e418962b2c39e6d4b114b09ce21736e7a..118de048b300ca864684e81aae7483503a1c5c2e 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -124,6 +124,34 @@ Foam::Field<Type>::Field } +template<class Type> +Foam::Field<Type>::Field +( + const UList<Type>& mapF, + const FieldMapper& mapper, + const Type& defaultValue +) +: + List<Type>(mapper.size(), defaultValue) +{ + map(mapF, mapper); +} + + +template<class Type> +Foam::Field<Type>::Field +( + const UList<Type>& mapF, + const FieldMapper& mapper, + const UList<Type>& defaultValues +) +: + List<Type>(defaultValues) +{ + map(mapF, mapper); +} + + template<class Type> Foam::Field<Type>::Field ( @@ -137,6 +165,34 @@ Foam::Field<Type>::Field } +template<class Type> +Foam::Field<Type>::Field +( + const tmp<Field<Type> >& tmapF, + const FieldMapper& mapper, + const Type& defaultValue +) +: + List<Type>(mapper.size(), defaultValue) +{ + map(tmapF, mapper); +} + + +template<class Type> +Foam::Field<Type>::Field +( + const tmp<Field<Type> >& tmapF, + const FieldMapper& mapper, + const UList<Type>& defaultValues +) +: + List<Type>(defaultValues) +{ + map(tmapF, mapper); +} + + template<class Type> Foam::Field<Type>::Field(const Field<Type>& f) : diff --git a/src/OpenFOAM/fields/Fields/Field/Field.H b/src/OpenFOAM/fields/Fields/Field/Field.H index 9b4088a4ebca5ec4978f2219604f4d672b31d6a4..dd3dbabeaef98b513e5db0686eda8637a830f7a2 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.H +++ b/src/OpenFOAM/fields/Fields/Field/Field.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -160,6 +160,22 @@ public: const FieldMapper& map ); + //- Construct by mapping from the given field + Field + ( + const UList<Type>& mapF, + const FieldMapper& map, + const Type& defaultValue + ); + + //- Construct by mapping from the given field + Field + ( + const UList<Type>& mapF, + const FieldMapper& map, + const UList<Type>& defaultValues + ); + //- Construct by mapping from the given tmp field Field ( @@ -167,6 +183,24 @@ public: const FieldMapper& map ); + //- Construct by mapping from the given tmp field. Supplied uniform + // value for unmapped items + Field + ( + const tmp<Field<Type> >& tmapF, + const FieldMapper& map, + const Type& defaultValue + ); + + //- Construct by mapping from the given tmp field. Supplied values + // for unmapped items + Field + ( + const tmp<Field<Type> >& tmapF, + const FieldMapper& map, + const UList<Type>& defaultValues + ); + //- Construct as copy Field(const Field<Type>&);