Commit 97be0673 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: additional constructors for IjkField

parent 8a459cdb
......@@ -36,7 +36,8 @@ template<class T>
Ostream& print(const IjkField<T>& fld)
{
Info<< static_cast<const Field<T>&>(fld).size()
<< " " << fld.sizes() << ' ' << flatOutput(fld);
<< " addr:" << long(fld.cdata()) << ' ' << fld.sizes() << ' '
<< flatOutput(fld);
return Info;
}
......@@ -102,6 +103,11 @@ int main(int argc, char *argv[])
Info<< "/= operator: "; print(field1) << nl;
IjkField<scalar> field3(std::move(field2));
Info<< "Move construct: "; print(field2) << nl;
print(field3) << nl;
// Field operations are still limited, but we can bypass things too
{
......
......@@ -25,17 +25,11 @@ Class
Foam::IjkField
Description
Generic templated field type.
Generic templated field type with i-j-k addressing.
SourceFiles
IjkFieldFunctions.H
IjkFieldFunctionsM.H
IjkFieldMapper.H
IjkFieldI.H
IjkFieldM.H
IjkField.C
IjkFieldFunctions.C
IjkFieldFunctionsM.C
\*---------------------------------------------------------------------------*/
......@@ -64,9 +58,6 @@ class IjkField
//- The i-j-k addressing
ijkAddressing ijk_;
//- Copy construct
inline IjkField(const IjkField<Type>& fld);
public:
......@@ -75,6 +66,12 @@ public:
//- Construct zero-sized
inline IjkField();
//- Copy construct
inline IjkField(const IjkField<Type>& field);
//- Move construct
inline IjkField(IjkField<Type>&& field);
//- Construct with sizing information, leaving values uninitialized
inline explicit IjkField(const labelVector& ijk);
......
......@@ -33,6 +33,22 @@ inline Foam::IjkField<Type>::IjkField()
{}
template<class Type>
inline Foam::IjkField<Type>::IjkField(const IjkField<Type>& field)
:
Field<Type>(field),
ijk_(field.ijk())
{}
template<class Type>
inline Foam::IjkField<Type>::IjkField(IjkField<Type>&& field)
:
Field<Type>(std::move(field)),
ijk_(field.ijk())
{}
template<class Type>
inline Foam::IjkField<Type>::IjkField(const labelVector& ijk)
:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment