Rename DataEntry -> Function1

Function1 is an abstract base-class of run-time selectable unary
functions which may be composed of other Function1's allowing the user
to specify complex functions of a single scalar variable, e.g. time.
The implementations need not be a simple or continuous functions;
interpolated tables and polynomials are also supported.  In fact form of
mapping between a single scalar input and a single primitive type output
is supportable.

The primary application of Function1 is in time-varying boundary
conditions, it also used for other functions of time, e.g. injected mass
is spray simulations but is not limited to functions of time.
This commit is contained in:
Henry Weller
2016-02-08 16:18:07 +00:00
parent c3f6a149d2
commit 968c888fc4
102 changed files with 497 additions and 494 deletions

View File

@ -0,0 +1,3 @@
Test-Function1.C
EXE = $(FOAM_USER_APPBIN)/Test-Function1

View File

@ -22,15 +22,15 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
testDataEntry
Test-Function1
Description
Tests DataEntry
Tests Function1
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "DataEntry.H"
#include "Function1.H"
#include "IOdictionary.H"
#include "linearInterpolationWeights.H"
#include "splineInterpolationWeights.H"
@ -54,8 +54,8 @@ int main(int argc, char *argv[])
//values[0] = 0.0;
//values[1] = 1.0;
//linearInterpolationWeights interpolator
splineInterpolationWeights interpolator
linearInterpolationWeights interpolator
//splineInterpolationWeights interpolator
(
samples
);
@ -98,11 +98,11 @@ int main(int argc, char *argv[])
return 1;
}
IOdictionary dataEntryProperties
IOdictionary function1Properties
(
IOobject
(
"dataEntryProperties",
"function1Properties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
@ -110,19 +110,19 @@ int main(int argc, char *argv[])
)
);
autoPtr<DataEntry<scalar>> dataEntry
autoPtr<Function1<scalar>> function1
(
DataEntry<scalar>::New
Function1<scalar>::New
(
"dataEntry",
dataEntryProperties
"function1",
function1Properties
)
);
scalar x0 = readScalar(dataEntryProperties.lookup("x0"));
scalar x1 = readScalar(dataEntryProperties.lookup("x1"));
scalar x0 = readScalar(function1Properties.lookup("x0"));
scalar x1 = readScalar(function1Properties.lookup("x1"));
Info<< "Data entry type: " << dataEntry().type() << nl << endl;
Info<< "Data entry type: " << function1().type() << nl << endl;
Info<< "Inputs" << nl
<< " x0 = " << x0 << nl
@ -130,12 +130,12 @@ int main(int argc, char *argv[])
<< endl;
Info<< "Interpolation" << nl
<< " f(x0) = " << dataEntry().value(x0) << nl
<< " f(x1) = " << dataEntry().value(x1) << nl
<< " f(x0) = " << function1().value(x0) << nl
<< " f(x1) = " << function1().value(x1) << nl
<< endl;
Info<< "Integration" << nl
<< " int(f(x)) lim(x0->x1) = " << dataEntry().integrate(x0, x1) << nl
<< " int(f(x)) lim(x0->x1) = " << function1().integrate(x0, x1) << nl
<< endl;
return 0;

View File

@ -11,7 +11,7 @@ FoamFile
format ascii;
class dictionary;
location "constant";
object dataEntryProperties;
object function1Properties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,7 +19,7 @@ x0 0.5;
x1 1;
dataEntry table ((0 0)(10 1));
function1 table ((0 0)(10 1));
// ************************************************************************* //

View File

@ -1,3 +0,0 @@
Test-DataEntry.C
EXE = $(FOAM_USER_APPBIN)/Test-DataEntry

View File

@ -135,7 +135,7 @@ int main(int argc, char *argv[])
#include "createFields.H"
Info<< "Reading data file" << endl;
DataEntryTypes::CSV<scalar> pData("pressure", dict, "Data");
Function1Types::CSV<scalar> pData("pressure", dict, "Data");
// time history data
const scalarField t(pData.x());