diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index 334eba8e41..118de048b3 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -124,6 +124,34 @@ Foam::Field::Field } +template +Foam::Field::Field +( + const UList& mapF, + const FieldMapper& mapper, + const Type& defaultValue +) +: + List(mapper.size(), defaultValue) +{ + map(mapF, mapper); +} + + +template +Foam::Field::Field +( + const UList& mapF, + const FieldMapper& mapper, + const UList& defaultValues +) +: + List(defaultValues) +{ + map(mapF, mapper); +} + + template Foam::Field::Field ( @@ -137,6 +165,34 @@ Foam::Field::Field } +template +Foam::Field::Field +( + const tmp >& tmapF, + const FieldMapper& mapper, + const Type& defaultValue +) +: + List(mapper.size(), defaultValue) +{ + map(tmapF, mapper); +} + + +template +Foam::Field::Field +( + const tmp >& tmapF, + const FieldMapper& mapper, + const UList& defaultValues +) +: + List(defaultValues) +{ + map(tmapF, mapper); +} + + template Foam::Field::Field(const Field& f) : diff --git a/src/OpenFOAM/fields/Fields/Field/Field.H b/src/OpenFOAM/fields/Fields/Field/Field.H index 9b4088a4eb..dd3dbabeae 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& mapF, + const FieldMapper& map, + const Type& defaultValue + ); + + //- Construct by mapping from the given field + Field + ( + const UList& mapF, + const FieldMapper& map, + const UList& 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 >& tmapF, + const FieldMapper& map, + const Type& defaultValue + ); + + //- Construct by mapping from the given tmp field. Supplied values + // for unmapped items + Field + ( + const tmp >& tmapF, + const FieldMapper& map, + const UList& defaultValues + ); + //- Construct as copy Field(const Field&);