ENH: array: check input. See #2445.

This commit is contained in:
mattijs
2022-04-14 10:29:19 +01:00
parent ab02e851cc
commit bc2299ed5f
2 changed files with 22 additions and 2 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018,2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -56,6 +56,15 @@ void Foam::arraySet::calcSamples
{ {
const meshSearch& queryMesh = searchEngine(); const meshSearch& queryMesh = searchEngine();
if (cmptMin(pointsDensity_) < 1)
{
FatalErrorInFunction << "Illegal specification for pointsDensity "
<< pointsDensity_
<< ". It specifies the number of points per coordinate axis"
<< " so should contain positive integers only."
<< exit(FatalError);
}
const scalar dx = spanBox_.x()/(pointsDensity_.x() + 1); const scalar dx = spanBox_.x()/(pointsDensity_.x() + 1);
const scalar dy = spanBox_.y()/(pointsDensity_.y() + 1); const scalar dy = spanBox_.y()/(pointsDensity_.y() + 1);
const scalar dz = spanBox_.z()/(pointsDensity_.z() + 1); const scalar dz = spanBox_.z()/(pointsDensity_.z() + 1);

View File

@ -39,7 +39,18 @@ Description
spanBox | The sample box dimensions (vector) | yes | spanBox | The sample box dimensions (vector) | yes |
\endtable \endtable
The dictionary can also contain an embedded coordinateSystem specification. The dictionary should also contain an embedded (Cartesian) coordinateSystem
specification, for example,
\verbatim
origin (-0.05 -0.05 -0.05);
rotation
{
type axes;
e1 (1 0 0);
e2 (0 1 0);
}
\endverbatim
SourceFiles SourceFiles
arraySet.C arraySet.C