ENH:Field: added default values to mapping constructor

This commit is contained in:
mattijs
2013-09-12 15:24:53 +01:00
parent 0cb4e1ecd8
commit e89fa0665e
2 changed files with 91 additions and 1 deletions

View File

@ -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)
:

View File

@ -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>&);