diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index f613a7e6a2..6ea997f3fd 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -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::checkTable() ) ); + if (vals.size() != mapperPtr_().sourceSize()) + { + FatalErrorIn + ( + "timeVaryingMappedFixedValueFvPatchField::" + "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::checkTable() false ) ); + + if (vals.size() != mapperPtr_().sourceSize()) + { + FatalErrorIn + ( + "timeVaryingMappedFixedValueFvPatchField::" + "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); } diff --git a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C index 1fa44b5d64..8bca126f9b 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValuePointPatchField.C @@ -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::checkTable() ) ); + if (vals.size() != mapperPtr_().sourceSize()) + { + FatalErrorIn + ( + "timeVaryingMappedFixedValuePointPatchField::" + "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::checkTable() false ) ); + + if (vals.size() != mapperPtr_().sourceSize()) + { + FatalErrorIn + ( + "timeVaryingMappedFixedValuePointPatchField::" + "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); } diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C index 9f8a6a5179..bc1402bd7a 100644 --- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C +++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C @@ -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); } diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H index daec2e4688..e3428d80fe 100644 --- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H +++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.H @@ -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 > nearestVertex_; @@ -114,6 +117,12 @@ public: return referenceCS_; } + //- Number of source points + label sourceSize() const + { + return nPoints_; + } + // patch const List >& nearestVertex() const { diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.C b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.C index 9159a03edd..f17f249d13 100644 --- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.C +++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolationTemplates.C @@ -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::pointToPointPlanarInterpolation::interpolate const Field& sourceFld ) const { + if (nPoints_ != sourceFld.size()) + { + FatalErrorIn + ( + "pointToPointPlanarInterpolation::interpolate" + "(const Field&) const" + ) << "Number of source points = " << nPoints_ + << " number of values = " << sourceFld.size() + << exit(FatalError); + } + tmp > tfld(new Field(nearestVertex_.size())); Field& fld = tfld();