mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use UPtrList::test() instead of separate bounds checking
This commit is contained in:
@ -368,11 +368,7 @@ Description
|
|||||||
{
|
{
|
||||||
const label nPatchFields =
|
const label nPatchFields =
|
||||||
(
|
(
|
||||||
(
|
(patchInterps.test(writeri) ? nVolFields : 0)
|
||||||
writeri < patchInterps.size() && patchInterps.set(writeri)
|
|
||||||
? nVolFields
|
|
||||||
: 0
|
|
||||||
)
|
|
||||||
+ nPointFields
|
+ nPointFields
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -116,7 +116,7 @@ label writeVolFields
|
|||||||
label writeri = 0;
|
label writeri = 0;
|
||||||
for (vtk::patchWriter& writer : patchWriters)
|
for (vtk::patchWriter& writer : patchWriters)
|
||||||
{
|
{
|
||||||
if (writeri < patchInterps.size() && patchInterps.set(writeri))
|
if (patchInterps.test(writeri))
|
||||||
{
|
{
|
||||||
writer.write(tfield(), patchInterps[writeri]);
|
writer.write(tfield(), patchInterps[writeri]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -712,15 +712,12 @@ void Foam::fvMeshAdder::MapDimField
|
|||||||
// Add fields to fields[0] after adding the meshes to meshes[0].
|
// Add fields to fields[0] after adding the meshes to meshes[0].
|
||||||
// Mesh[0] is the sum of all meshes. Fields are not yet mapped.
|
// Mesh[0] is the sum of all meshes. Fields are not yet mapped.
|
||||||
|
|
||||||
if
|
if (!flds.test(0) || cellProcAddressing.size() != flds.size())
|
||||||
(
|
|
||||||
flds.size() == 0
|
|
||||||
|| !flds.set(0)
|
|
||||||
|| cellProcAddressing.size() != flds.size()
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction << "Not valid field at element 0"
|
FatalErrorInFunction
|
||||||
<< " in field list of size " << flds.size() << exit(FatalError);
|
<< "Not valid field at element 0 in list of size "
|
||||||
|
<< flds.size() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -766,10 +763,12 @@ void Foam::fvMeshAdder::MapVolField
|
|||||||
// Add fields to fields[0] after adding the meshes to meshes[0].
|
// Add fields to fields[0] after adding the meshes to meshes[0].
|
||||||
// Mesh[0] is the sum of all meshes. Fields are not yet mapped.
|
// Mesh[0] is the sum of all meshes. Fields are not yet mapped.
|
||||||
|
|
||||||
if (flds.size() == 0 || !flds.set(0))
|
if (!flds.test(0))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction << "Not valid field at element 0"
|
FatalErrorInFunction
|
||||||
<< " in field list of size " << flds.size() << exit(FatalError);
|
<< "Not valid field at element 0 in list of size "
|
||||||
|
<< flds.size() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -902,10 +901,12 @@ void Foam::fvMeshAdder::MapSurfaceField
|
|||||||
// Add fields to fields[0] after adding the meshes to meshes[0].
|
// Add fields to fields[0] after adding the meshes to meshes[0].
|
||||||
// Mesh[0] is the sum of all meshes. Fields are not yet mapped.
|
// Mesh[0] is the sum of all meshes. Fields are not yet mapped.
|
||||||
|
|
||||||
if (flds.size() == 0 || !flds.set(0))
|
if (!flds.test(0))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction << "Not valid field at element 0"
|
FatalErrorInFunction
|
||||||
<< " in field list of size " << flds.size() << exit(FatalError);
|
<< "Not valid field at element 0 in list of size "
|
||||||
|
<< flds.size() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh0 = flds[0].mesh();
|
const fvMesh& mesh0 = flds[0].mesh();
|
||||||
@ -1105,12 +1106,14 @@ void Foam::fvMeshAdder::MapVolFields
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> fldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> fldType;
|
||||||
|
|
||||||
if (meshes.size() == 0 || !meshes.set(0))
|
if (!meshes.test(0))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction << "Not valid field at element 0"
|
FatalErrorInFunction
|
||||||
<< " in mesh list of size " << meshes.size() << exit(FatalError);
|
<< "Not valid mesh at element 0 in list of size "
|
||||||
|
<< meshes.size() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
const fvMesh& mesh0 = meshes[0];
|
const auto& mesh0 = meshes[0];
|
||||||
|
|
||||||
HashTable<const fldType*> fields
|
HashTable<const fldType*> fields
|
||||||
(
|
(
|
||||||
@ -1176,12 +1179,14 @@ void Foam::fvMeshAdder::MapDimFields
|
|||||||
typedef DimensionedField<Type, volMesh> fldType;
|
typedef DimensionedField<Type, volMesh> fldType;
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> excludeType;
|
typedef GeometricField<Type, fvPatchField, volMesh> excludeType;
|
||||||
|
|
||||||
if (meshes.size() == 0 || !meshes.set(0))
|
if (!meshes.test(0))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction << "Not valid field at element 0"
|
FatalErrorInFunction
|
||||||
<< " in mesh list of size " << meshes.size() << exit(FatalError);
|
<< "Not valid mesh at element 0 in list of size "
|
||||||
|
<< meshes.size() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
const fvMesh& mesh0 = meshes[0];
|
const auto& mesh0 = meshes[0];
|
||||||
|
|
||||||
HashTable<const fldType*> fields
|
HashTable<const fldType*> fields
|
||||||
(
|
(
|
||||||
@ -1236,10 +1241,12 @@ void Foam::fvMeshAdder::MapSurfaceFields
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> fldType;
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> fldType;
|
||||||
|
|
||||||
if (meshes.size() == 0 || !meshes.set(0))
|
if (!meshes.test(0))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction << "Not valid field at element 0"
|
FatalErrorInFunction
|
||||||
<< " in mesh list of size " << meshes.size() << exit(FatalError);
|
<< "Not valid mesh at element 0 in list of size "
|
||||||
|
<< meshes.size() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
const auto& mesh0 = meshes[0];
|
const auto& mesh0 = meshes[0];
|
||||||
|
|
||||||
|
|||||||
@ -627,9 +627,7 @@ bool Foam::functionObjects::vtkWrite::write()
|
|||||||
{
|
{
|
||||||
const label nPatchFields =
|
const label nPatchFields =
|
||||||
(
|
(
|
||||||
writeri < patchInterps.size() && patchInterps.set(writeri)
|
patchInterps.test(writeri) ? nVolFields : 0
|
||||||
? nVolFields
|
|
||||||
: 0
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (nPatchFields)
|
if (nPatchFields)
|
||||||
|
|||||||
@ -128,7 +128,7 @@ Foam::label Foam::functionObjects::vtkWrite::writeVolFieldsImpl
|
|||||||
label writeri = 0;
|
label writeri = 0;
|
||||||
for (vtk::patchWriter& writer : patchWriters)
|
for (vtk::patchWriter& writer : patchWriters)
|
||||||
{
|
{
|
||||||
if (writeri < patchInterps.size() && patchInterps.set(writeri))
|
if (patchInterps.test(writeri))
|
||||||
{
|
{
|
||||||
ok = true;
|
ok = true;
|
||||||
writer.write(field, patchInterps[writeri]);
|
writer.write(field, patchInterps[writeri]);
|
||||||
|
|||||||
Reference in New Issue
Block a user