mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added helper function to return CSV data as fields
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -414,6 +414,36 @@ Foam::dimensioned<Type> Foam::TableBase<Type>::dimIntegrate
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::scalarField> Foam::TableBase<Type>::x() const
|
||||||
|
{
|
||||||
|
tmp<scalarField> tfld(new scalarField(table_.size(), 0.0));
|
||||||
|
scalarField& fld = tfld();
|
||||||
|
|
||||||
|
forAll(table_, i)
|
||||||
|
{
|
||||||
|
fld[i] = table_[i].first();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tfld;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type> > Foam::TableBase<Type>::y() const
|
||||||
|
{
|
||||||
|
tmp<Field<Type> > tfld(new Field<Type>(table_.size(), pTraits<Type>::zero));
|
||||||
|
Field<Type>& fld = tfld();
|
||||||
|
|
||||||
|
forAll(table_, i)
|
||||||
|
{
|
||||||
|
fld[i] = table_[i].second();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tfld;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "TableBaseIO.C"
|
#include "TableBaseIO.C"
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -172,6 +172,12 @@ public:
|
|||||||
const scalar x2
|
const scalar x2
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Return the reference values
|
||||||
|
virtual tmp<scalarField> x() const;
|
||||||
|
|
||||||
|
//- Return the dependent values
|
||||||
|
virtual tmp<Field<Type> > y() const;
|
||||||
|
|
||||||
|
|
||||||
// I/O
|
// I/O
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user