Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (2)
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -396,9 +396,7 @@ setColourMap
vtkLookupTable* lut
) const
{
constexpr label nColours = 256;
lut->SetNumberOfColors(nColours);
lut->SetNumberOfColors(nColours_);
auto ctf = vtkSmartPointer<vtkColorTransferFunction>::New();
......@@ -467,9 +465,9 @@ setColourMap
double rgba[4] = { 0, 0, 0, 1 };
for (label i = 0; i < nColours; ++i)
for (int i = 0; i < nColours_; ++i)
{
ctf->GetColor(scalar(i)/scalar(nColours), rgba);
ctf->GetColor(double(i)/double(nColours_), rgba);
lut->SetTableValue(i, rgba);
}
}
......@@ -747,6 +745,7 @@ fieldVisualisationBase
smooth_(dict.getOrDefault("smooth", false)),
colourBy_(cbColour),
colourMap_(cmRainbow),
nColours_(256),
range_(),
scalarBar_()
{
......@@ -763,10 +762,16 @@ fieldVisualisationBase
case cbField:
{
dict.readEntry("range", range_);
colourMapTypeNames.readIfPresent("colourMap", dict, colourMap_);
const dictionary* sbar = dict.findDict("scalarBar");
dict.readIfPresent("nColours", nColours_);
if (nColours_ < 2)
{
nColours_ = 2;
}
const dictionary* sbar = dict.findDict("scalarBar");
if (sbar)
{
scalarBar_.read(*sbar);
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -36,6 +36,7 @@ Description
range | Lower/upper range to display | yes |
smooth | Request smoother output | no | false
colourMap | Colour map for rendering | no | rainbow
nColours | Number of colours in colour map | no | 256
scalarBar | Scalar-bar sub-dictionary | yes |
\endtable
......@@ -100,7 +101,7 @@ public:
// Public Enumerations
//- Colouring type
enum colourByType
enum colourByType : uint8_t
{
cbColour, //!< "colour" : Use specified colour
cbField //!< "field" : Use named field
......@@ -110,7 +111,7 @@ public:
static const Enum<colourByType> colourByTypeNames;
//- Colour map enumerations
enum colourMapType
enum colourMapType : uint8_t
{
cmCoolToWarm, //!< ParaView "Cool To Warm" blue-white-read
cmBlueWhiteRed = cmCoolToWarm,
......@@ -207,6 +208,9 @@ protected:
//- Colour map type
colourMapType colourMap_;
//- Number of colours in colour map
int nColours_;
//- Range of values
Tuple2<scalar, scalar> range_;
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -81,24 +81,19 @@ Foam::functionObjects::runTimePostPro::geometryCloud::gatherCloud
// Receive points
pointField points;
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
++slave
)
for (const int proci : Pstream::subProcs())
{
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
IPstream fromProc(Pstream::commsTypes::scheduled, proci);
points.clear();
fromSlave >> points;
fromProc >> points;
if (points.size())
{
multiPiece->SetPiece
(
slave,
proci,
Foam::vtk::Tools::Vertices(points)
);
}
......@@ -106,7 +101,7 @@ Foam::functionObjects::runTimePostPro::geometryCloud::gatherCloud
}
else
{
// Slave - send points
// Sub-process - send points
OPstream toMaster
(
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -99,25 +99,19 @@ bool Foam::functionObjects::runTimePostPro::geometryCloud::addCloudField
// Receive field data
Field<Type> recv;
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
++slave
)
for (const int proci : Pstream::subProcs())
{
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
IPstream fromProc(Pstream::commsTypes::scheduled, proci);
recv.clear();
fromSlave
>> recv;
fromProc >> recv;
if (recv.size())
{
addField<Type>
(
multiPiece->GetPiece(slave),
multiPiece->GetPiece(proci),
recv,
fieldName
);
......@@ -126,7 +120,7 @@ bool Foam::functionObjects::runTimePostPro::geometryCloud::addCloudField
}
else
{
// Slave - send field data
// Sub-process - send field data
OPstream toMaster
(
......@@ -136,13 +130,11 @@ bool Foam::functionObjects::runTimePostPro::geometryCloud::addCloudField
if (fldptr)
{
toMaster
<< *fldptr;
toMaster << *fldptr;
}
else
{
toMaster
<< List<Type>();
toMaster << Field<Type>();
}
}
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -108,29 +108,23 @@ Foam::functionObjects::runTimePostPro::geometryPatches::gatherPatchPieces
pointField points;
faceList faces;
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
++slave
)
for (const int proci : Pstream::subProcs())
{
const label nSlavePatches = patchIds[slave].size();
const label nPatches = patchIds[proci].size();
if (!nSlavePatches)
if (!nPatches)
{
continue;
}
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
IPstream fromProc(Pstream::commsTypes::scheduled, proci);
for (label recvi=0; recvi < nSlavePatches; ++recvi)
for (label recvi=0; recvi < nPatches; ++recvi)
{
points.clear();
faces.clear();
fromSlave
>> points >> faces;
fromProc >> points >> faces;
multiPiece->SetPiece
(
......@@ -144,10 +138,9 @@ Foam::functionObjects::runTimePostPro::geometryPatches::gatherPatchPieces
}
else
{
// Slave - send surfaces
const labelList& slavePatchIds = patchIds[Pstream::myProcNo()];
// Sub-process - send surfaces
if (slavePatchIds.size())
if (patchIds[Pstream::myProcNo()].size())
{
OPstream toMaster
(
......@@ -159,8 +152,7 @@ Foam::functionObjects::runTimePostPro::geometryPatches::gatherPatchPieces
{
const polyPatch& pp = patches[patchId];
toMaster
<< pp.localPoints() << pp.localFaces();
toMaster << pp.localPoints() << pp.localFaces();
}
}
}
......@@ -233,27 +225,22 @@ Foam::functionObjects::runTimePostPro::geometryPatches::gatherPatchFaceCentres
// Receive points
pointField points;
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
++slave
)
for (const int proci : Pstream::subProcs())
{
const label nSlavePatches = patchIds[slave].size();
const label nPatches = patchIds[proci].size();
if (!nSlavePatches)
if (!nPatches)
{
continue;
}
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
IPstream fromProc(Pstream::commsTypes::scheduled, proci);
for (label recvi=0; recvi < nSlavePatches; ++recvi)
for (label recvi=0; recvi < nPatches; ++recvi)
{
points.clear();
fromSlave >> points;
fromProc >> points;
multiPiece->SetPiece
(
......@@ -267,11 +254,9 @@ Foam::functionObjects::runTimePostPro::geometryPatches::gatherPatchFaceCentres
}
else
{
// Slave - send face centres
// Sub-process - send face centres
const labelList& slavePatchIds = patchIds[Pstream::myProcNo()];
if (slavePatchIds.size())
if (patchIds[Pstream::myProcNo()].size())
{
OPstream toMaster
(
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -143,27 +143,22 @@ int Foam::functionObjects::runTimePostPro::geometryPatches::addPatchField
// Receive field
Field<Type> recv;
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
++slave
)
for (const int proci : Pstream::subProcs())
{
const label nSlavePatches = patchIds[slave].size();
const label nPatches = patchIds[proci].size();
if (!nSlavePatches)
if (!nPatches)
{
continue;
}
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
IPstream fromProc(Pstream::commsTypes::scheduled, proci);
for (label recvi=0; recvi < nSlavePatches; ++recvi)
for (label recvi=0; recvi < nPatches; ++recvi)
{
recv.clear();
fromSlave >> recv;
fromProc >> recv;
auto vtkfield = Foam::vtk::Tools::convertFieldToVTK<Type>
(
......@@ -189,10 +184,9 @@ int Foam::functionObjects::runTimePostPro::geometryPatches::addPatchField
}
else
{
// Slave - send fields
const labelList& slavePatchIds = patchIds[Pstream::myProcNo()];
// Sub-process - send fields
if (slavePatchIds.size())
if (patchIds[Pstream::myProcNo()].size())
{
OPstream toMaster
(
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -27,6 +27,7 @@ License
// OpenFOAM includes
#include "runTimePostProcessing.H"
#include "geometrySurface.H"
#include "dictionary.H"
#include "pointData.H"
#include "pathline.H"
......@@ -322,7 +323,9 @@ bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
if (dict.getOrDefault("debug", false))
{
debug = 1;
runTimePostPro::geometryBase::debug = 1;
runTimePostPro::geometrySurface::debug = 1;
Info<< " debugging on" << endl;
}
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -212,7 +212,7 @@ Foam::functionObjects::runTimePostPro::surface::surface
),
featureEdges_(dict.getOrDefault("featureEdges", false)),
backFaceCulling_(dict.getOrDefault("backFaceCulling", false)),
frontFaceCulling_(dict.getOrDefault("frontFaceCulling", true)),
frontFaceCulling_(dict.getOrDefault("frontFaceCulling", false)),
surfaceColour_(nullptr),
edgeColour_(nullptr),
surfaceActor_(),
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -39,7 +39,7 @@ Description
featureEdges | Display surface feature edges | no | false
maxGlyphLength | Limit for glyph representation | yes | 0
backFaceCulling | Cull back face | no | false
frontFaceCulling | Cull front face | no | true
frontFaceCulling | Cull front face | no | false
\endtable
SourceFiles
......@@ -173,7 +173,7 @@ protected:
//- Back face culling option; default = off
bool backFaceCulling_;
//- Front face culling option; default = on
//- Front face culling option; default = off
bool frontFaceCulling_;
//- Surface colour
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -80,25 +80,20 @@ Foam::functionObjects::runTimePostPro::surface::gatherSurfacePieces
pointField points;
faceList faces;
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
++slave
)
for (const int proci : Pstream::subProcs())
{
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
IPstream fromProc(Pstream::commsTypes::scheduled, proci);
points.clear();
faces.clear();
fromSlave >> points >> faces;
fromProc >> points >> faces;
if (points.size())
{
multiPiece->SetPiece
(
slave,
proci,
Foam::vtk::Tools::Patch::mesh(points, faces)
);
}
......@@ -106,7 +101,7 @@ Foam::functionObjects::runTimePostPro::surface::gatherSurfacePieces
}
else
{
// Slave - send surfaces
// Sub-process - send surfaces
OPstream toMaster
(
......@@ -116,13 +111,11 @@ Foam::functionObjects::runTimePostPro::surface::gatherSurfacePieces
if (surf)
{
toMaster
<< surf->points() << surf->faces();
toMaster << surf->points() << surf->faces();
}
else
{
toMaster
<< pointField() << faceList();
toMaster << pointField() << faceList();
}
}
......@@ -174,24 +167,19 @@ Foam::functionObjects::runTimePostPro::surface::gatherFaceCentres
// Receive points
pointField points;
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
++slave
)
for (const int proci : Pstream::subProcs())
{
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
IPstream fromProc(Pstream::commsTypes::scheduled, proci);
points.clear();
fromSlave >> points;
fromProc >> points;
if (points.size())
{
multiPiece->SetPiece
(
slave,
proci,
Foam::vtk::Tools::Vertices(points)
);
}
......@@ -199,7 +187,7 @@ Foam::functionObjects::runTimePostPro::surface::gatherFaceCentres
}
else
{
// Slave - send face centres
// Sub-process - send face centres
OPstream toMaster
(
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -167,25 +167,19 @@ bool Foam::functionObjects::runTimePostPro::surface::addDimField
// Receive field data
Field<Type> recv;
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
++slave
)
for (const int proci : Pstream::subProcs())
{
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
IPstream fromProc(Pstream::commsTypes::scheduled, proci);
recv.clear();
fromSlave
>> recv;
fromProc >> recv;
if (recv.size())
{
addField<Type, GeoMeshType>
(
multiPiece->GetPiece(slave),
multiPiece->GetPiece(proci),
recv,
fieldName
);
......@@ -194,7 +188,7 @@ bool Foam::functionObjects::runTimePostPro::surface::addDimField
}
else
{
// Slave - send field data
// Sub-process - send field data
OPstream toMaster
(
......@@ -204,13 +198,11 @@ bool Foam::functionObjects::runTimePostPro::surface::addDimField
if (fldptr)
{
toMaster
<< fldptr->field();
toMaster << fldptr->field();
}
else
{
toMaster
<< List<Type>();
toMaster << Field<Type>();
}
}
......