ENH: timeVaryingMapped: added checking

This commit is contained in:
mattijs
2013-02-06 11:37:45 +00:00
parent 5e7a807413
commit d5ef310d43
5 changed files with 79 additions and 7 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -343,6 +343,18 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
)
);
if (vals.size() != mapperPtr_().sourceSize())
{
FatalErrorIn
(
"timeVaryingMappedFixedValueFvPatchField<Type>::"
"checkTable()"
) << "Number of values (" << vals.size()
<< ") differs from the number of points ("
<< mapperPtr_().sourceSize()
<< ") in file " << vals.objectPath() << exit(FatalError);
}
startAverage_ = vals.average();
startSampledValues_ = mapperPtr_().interpolate(vals);
}
@ -388,6 +400,19 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
false
)
);
if (vals.size() != mapperPtr_().sourceSize())
{
FatalErrorIn
(
"timeVaryingMappedFixedValueFvPatchField<Type>::"
"checkTable()"
) << "Number of values (" << vals.size()
<< ") differs from the number of points ("
<< mapperPtr_().sourceSize()
<< ") in file " << vals.objectPath() << exit(FatalError);
}
endAverage_ = vals.average();
endSampledValues_ = mapperPtr_().interpolate(vals);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -313,6 +313,18 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable()
)
);
if (vals.size() != mapperPtr_().sourceSize())
{
FatalErrorIn
(
"timeVaryingMappedFixedValuePointPatchField<Type>::"
"checkTable()"
) << "Number of values (" << vals.size()
<< ") differs from the number of points ("
<< mapperPtr_().sourceSize()
<< ") in file " << vals.objectPath() << exit(FatalError);
}
startAverage_ = vals.average();
startSampledValues_ = mapperPtr_().interpolate(vals);
}
@ -357,6 +369,19 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable()
false
)
);
if (vals.size() != mapperPtr_().sourceSize())
{
FatalErrorIn
(
"timeVaryingMappedFixedValuePointPatchField<Type>::"
"checkTable()"
) << "Number of values (" << vals.size()
<< ") differs from the number of points ("
<< mapperPtr_().sourceSize()
<< ") in file " << vals.objectPath() << exit(FatalError);
}
endAverage_ = vals.average();
endSampledValues_ = mapperPtr_().interpolate(vals);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -222,7 +222,8 @@ Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation
)
:
perturb_(perturb),
referenceCS_(calcCoordinateSystem(sourcePoints))
referenceCS_(calcCoordinateSystem(sourcePoints)),
nPoints_(sourcePoints.size())
{
calcWeights(sourcePoints, destPoints);
@ -238,7 +239,8 @@ Foam::pointToPointPlanarInterpolation::pointToPointPlanarInterpolation
)
:
perturb_(perturb),
referenceCS_(referenceCS)
referenceCS_(referenceCS),
nPoints_(sourcePoints.size())
{
calcWeights(sourcePoints, destPoints);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -59,6 +59,9 @@ class pointToPointPlanarInterpolation
//- Coordinate system
coordinateSystem referenceCS_;
//- Number of source points (for checking)
label nPoints_;
//- Current interpolation addressing to face centres of underlying
// patch
List<FixedList<label, 3> > nearestVertex_;
@ -114,6 +117,12 @@ public:
return referenceCS_;
}
//- Number of source points
label sourceSize() const
{
return nPoints_;
}
// patch
const List<FixedList<label, 3> >& nearestVertex() const
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,6 +33,17 @@ Foam::tmp<Foam::Field<Type> > Foam::pointToPointPlanarInterpolation::interpolate
const Field<Type>& sourceFld
) const
{
if (nPoints_ != sourceFld.size())
{
FatalErrorIn
(
"pointToPointPlanarInterpolation::interpolate"
"(const Field<Type>&) const"
) << "Number of source points = " << nPoints_
<< " number of values = " << sourceFld.size()
<< exit(FatalError);
}
tmp<Field<Type> > tfld(new Field<Type>(nearestVertex_.size()));
Field<Type>& fld = tfld();