Commit 4c7750cd authored by Andrew Heather's avatar Andrew Heather

ENH: runTimePostProcessing - updated to use c++0x and replaced DataEntry by Function1

parent 6f561b0e
......@@ -32,13 +32,13 @@ add_definitions(
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS_DEBUG
"-g -O0 -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -Wno-overloaded-virtual"
"-g -O0 -std=c++0x -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -Wno-overloaded-virtual"
)
set(CMAKE_C_FLAGS_DEBUG "-g -O0")
set(CMAKE_C_FLAGS_DEBUG "-g -O0 -std=c++0x")
set(CMAKE_CXX_FLAGS_RELEASE
"-O3 -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -Wno-overloaded-virtual")
set(CMAKE_C_FLAGS_RELEASE "-O3")
"-O3 -std=c++0x -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -Wno-overloaded-virtual")
set(CMAKE_C_FLAGS_RELEASE "-O3 -std=c++0x")
# Set output library destination to plugin directory
set(LIBRARY_OUTPUT_PATH $ENV{FOAM_LIBBIN}
......
......@@ -437,7 +437,7 @@ Foam::fieldVisualisationBase::fieldVisualisationBase
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
)
:
parent_(parent),
......@@ -489,7 +489,7 @@ Foam::fieldVisualisationBase::~fieldVisualisationBase()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::HashPtrTable<Foam::DataEntry<Foam::vector>, Foam::word>&
const Foam::HashPtrTable<Foam::Function1<Foam::vector>, Foam::word>&
Foam::fieldVisualisationBase::colours() const
{
return colours_;
......
......@@ -39,7 +39,7 @@ SourceFiles
#include "NamedEnum.H"
#include "vector.H"
#include "HashPtrTable.H"
#include "DataEntry.H"
#include "Function1.H"
#include "vtkSmartPointer.h"
......@@ -121,7 +121,7 @@ protected:
};
//- Colours
const HashPtrTable<DataEntry<vector>, word>& colours_;
const HashPtrTable<Function1<vector>, word>& colours_;
//- Field name
word fieldName_;
......@@ -183,7 +183,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
);
......@@ -196,7 +196,7 @@ public:
// Access
//- Return the colours
const HashPtrTable<DataEntry<vector>, word>& colours() const;
const HashPtrTable<Function1<vector>, word>& colours() const;
//- Return the field name
const word& fieldName() const;
......
......@@ -51,7 +51,7 @@ Foam::functionObjectCloud::functionObjectCloud
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
)
:
pointData(parent, dict, colours),
......
......@@ -92,7 +92,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
);
......
......@@ -51,7 +51,7 @@ Foam::functionObjectLine::functionObjectLine
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
)
:
pathline(parent, dict, colours),
......
......@@ -86,7 +86,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
);
......
......@@ -51,7 +51,7 @@ Foam::functionObjectSurface::functionObjectSurface
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
)
:
geometrySurface(parent, dict, colours, List<fileName>()),
......
......@@ -85,7 +85,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
);
......
......@@ -81,7 +81,7 @@ Foam::geometryBase::geometryBase
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
)
:
parent_(parent),
......@@ -98,11 +98,11 @@ Foam::geometryBase::geometryBase
if (dict.found("opacity"))
{
opacity_.reset(DataEntry<scalar>::New("opacity", dict).ptr());
opacity_.reset(Function1<scalar>::New("opacity", dict).ptr());
}
else
{
opacity_.reset(new Constant<scalar>("opacity", 1.0));
opacity_.reset(new Function1Types::Constant<scalar>("opacity", 1.0));
}
}
......@@ -139,7 +139,7 @@ Foam::scalar Foam::geometryBase::opacity(const scalar position) const
}
const Foam::HashPtrTable<Foam::DataEntry<Foam::vector>, Foam::word>&
const Foam::HashPtrTable<Foam::Function1<Foam::vector>, Foam::word>&
Foam::geometryBase::colours() const
{
return colours_;
......
......@@ -36,7 +36,7 @@ SourceFiles
#include "dictionary.H"
#include "vector.H"
#include "DataEntry.H"
#include "Function1.H"
#include "HashPtrTable.H"
#include "NamedEnum.H"
......@@ -99,10 +99,10 @@ protected:
renderModeType renderMode_;
//- Opacity
autoPtr<DataEntry<scalar> > opacity_;
autoPtr<Function1<scalar>> opacity_;
//- Reference to the colours
const HashPtrTable<DataEntry<vector>, word>& colours_;
const HashPtrTable<Function1<vector>, word>& colours_;
// Protected functions
......@@ -120,7 +120,7 @@ public:
(
const runTimePostProcessing& parent_,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
);
......@@ -145,7 +145,7 @@ public:
scalar opacity(const scalar position) const;
//- Return reference to the colours
const HashPtrTable<DataEntry<vector>, word>& colours() const;
const HashPtrTable<Function1<vector>, word>& colours() const;
//- Add geometry to scene
......
......@@ -136,7 +136,7 @@ Foam::geometrySurface::geometrySurface
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
)
:
surface(parent, dict, colours),
......@@ -148,7 +148,7 @@ Foam::geometrySurface::geometrySurface
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours,
const HashPtrTable<Function1<vector>, word>& colours,
const List<fileName>& fileNames
)
:
......
......@@ -94,7 +94,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
);
//- Construct from components
......@@ -102,7 +102,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours,
const HashPtrTable<Function1<vector>, word>& colours,
const List<fileName>& fileNames
);
......
......@@ -118,7 +118,7 @@ Foam::pathline::pathline
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
)
:
geometryBase(parent, dict, colours),
......@@ -131,7 +131,7 @@ Foam::pathline::pathline
{
if (dict.found("lineColour"))
{
lineColour_.reset(DataEntry<vector>::New("lineColour", dict).ptr());
lineColour_.reset(Function1<vector>::New("lineColour", dict).ptr());
}
else
{
......@@ -168,7 +168,7 @@ Foam::autoPtr<Foam::pathline> Foam::pathline::New
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours,
const HashPtrTable<Function1<vector>, word>& colours,
const word& pathlineType
)
{
......
......@@ -92,7 +92,7 @@ protected:
scalar tubeRadius_;
//- Line colour
autoPtr<DataEntry<vector> > lineColour_;
autoPtr<Function1<vector>> lineColour_;
// Protected Member Functions
......@@ -122,7 +122,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
),
(parent, dict, colours)
);
......@@ -135,7 +135,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
);
......@@ -146,7 +146,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours,
const HashPtrTable<Function1<vector>, word>& colours,
const word& pathlineName
);
......
......@@ -87,7 +87,7 @@ Foam::pointData::pointData
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
)
:
geometryBase(parent, dict, colours),
......@@ -100,7 +100,7 @@ Foam::pointData::pointData
{
if (dict.found("pointColour"))
{
pointColour_.reset(DataEntry<vector>::New("pointColour", dict).ptr());
pointColour_.reset(Function1<vector>::New("pointColour", dict).ptr());
}
else
{
......@@ -128,7 +128,7 @@ Foam::autoPtr<Foam::pointData> Foam::pointData::New
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours,
const HashPtrTable<Function1<vector>, word>& colours,
const word& pointDataType
)
{
......
......@@ -90,7 +90,7 @@ protected:
scalar maxGlyphLength_;
//- Point colour
autoPtr<DataEntry<vector> > pointColour_;
autoPtr<Function1<vector>> pointColour_;
// Protected Member Functions
......@@ -121,7 +121,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
),
(parent, dict, colours)
);
......@@ -134,7 +134,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
);
......@@ -145,7 +145,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours,
const HashPtrTable<Function1<vector>, word>& colours,
const word& pointDataName
);
......
......@@ -103,27 +103,30 @@ void Foam::scene::readCamera(const dictionary& dict)
{
clipBox_ = boundBox(coeffs.lookup("clipBox"));
const vector lookDir(vector(coeffs.lookup("lookDir")));
cameraPosition_.reset(new Constant<point>("position", -lookDir));
cameraPosition_.reset
(
new Function1Types::Constant<point>("position", -lookDir)
);
const vector focalPoint(coeffs.lookup("focalPoint"));
cameraFocalPoint_.reset
(
new Constant<point>("focalPoint", focalPoint)
new Function1Types::Constant<point>("focalPoint", focalPoint)
);
const vector up(coeffs.lookup("up"));
cameraUp_.reset(new Constant<point>("up", up));
cameraUp_.reset(new Function1Types::Constant<point>("up", up));
break;
}
case mtFlightPath:
{
cameraPosition_.reset
(
DataEntry<vector>::New("position", coeffs).ptr()
Function1<vector>::New("position", coeffs).ptr()
);
cameraFocalPoint_.reset
(
DataEntry<point>::New("focalPoint", coeffs).ptr()
Function1<point>::New("focalPoint", coeffs).ptr()
);
cameraUp_.reset(DataEntry<vector>::New("up", coeffs).ptr());
cameraUp_.reset(Function1<vector>::New("up", coeffs).ptr());
break;
}
default:
......@@ -136,20 +139,23 @@ void Foam::scene::readCamera(const dictionary& dict)
if (dict.found("zoom"))
{
cameraZoom_.reset(DataEntry<scalar>::New("zoom", dict).ptr());
cameraZoom_.reset(Function1<scalar>::New("zoom", dict).ptr());
}
else
{
cameraZoom_.reset(new Constant<scalar>("zoom", 1.0));
cameraZoom_.reset(new Function1Types::Constant<scalar>("zoom", 1.0));
}
if (dict.found("viewAngle"))
{
cameraViewAngle_.reset(DataEntry<scalar>::New("viewAngle", dict).ptr());
cameraViewAngle_.reset(Function1<scalar>::New("viewAngle", dict).ptr());
}
else
{
cameraViewAngle_.reset(new Constant<scalar>("viewAngle", 35.0));
cameraViewAngle_.reset
(
new Function1Types::Constant<scalar>("viewAngle", 35.0)
);
}
}
......@@ -160,7 +166,7 @@ void Foam::scene::readColours(const dictionary& dict)
forAll(colours, i)
{
const word& c = colours[i];
colours_.insert(c, DataEntry<vector>::New(c, dict).ptr());
colours_.insert(c, Function1<vector>::New(c, dict).ptr());
}
}
......@@ -305,7 +311,7 @@ Foam::scene::~scene()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::HashPtrTable<Foam::DataEntry<Foam::vector>, Foam::word>&
const Foam::HashPtrTable<Foam::Function1<Foam::vector>, Foam::word>&
Foam::scene::colours() const
{
return colours_;
......
......@@ -36,7 +36,7 @@ SourceFiles
// OpenFOAM includes
#include "dictionary.H"
#include "DataEntry.H"
#include "Function1.H"
#include "vector.H"
#include "point.H"
#include "boundBox.H"
......@@ -99,7 +99,7 @@ protected:
// Protected data
//- Colours
HashPtrTable<DataEntry<vector>, word> colours_;
HashPtrTable<Function1<vector>, word> colours_;
// Camera settings
......@@ -108,19 +108,19 @@ protected:
modeType mode_;
//- Position
autoPtr<DataEntry<point> > cameraPosition_;
autoPtr<Function1<point>> cameraPosition_;
//- Focal point
autoPtr<DataEntry<point> > cameraFocalPoint_;
autoPtr<Function1<point>> cameraFocalPoint_;
//- Up direction
autoPtr<DataEntry<vector> > cameraUp_;
autoPtr<Function1<vector>> cameraUp_;
//- Zoom level
autoPtr<DataEntry<scalar> > cameraZoom_;
autoPtr<Function1<scalar>> cameraZoom_;
//- View angle
autoPtr<DataEntry<scalar> > cameraViewAngle_;
autoPtr<Function1<scalar>> cameraViewAngle_;
// Scene management
......@@ -171,7 +171,7 @@ public:
// Access
//- Return the colours
const HashPtrTable<DataEntry<vector>, word>& colours() const;
const HashPtrTable<Function1<vector>, word>& colours() const;
//- Return the current frame index
label frameIndex() const;
......
......@@ -135,7 +135,7 @@ Foam::surface::surface
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
)
:
geometryBase(parent, dict, colours),
......@@ -157,7 +157,7 @@ Foam::surface::surface
{
surfaceColour_.reset
(
DataEntry<vector>::New("surfaceColour", dict).ptr()
Function1<vector>::New("surfaceColour", dict).ptr()
);
}
else
......@@ -167,7 +167,7 @@ Foam::surface::surface
if (dict.found("edgeColour"))
{
edgeColour_.reset(DataEntry<vector>::New("edgeColour", dict).ptr());
edgeColour_.reset(Function1<vector>::New("edgeColour", dict).ptr());
}
else
{
......@@ -191,7 +191,7 @@ Foam::autoPtr<Foam::surface> Foam::surface::New
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours,
const HashPtrTable<Function1<vector>, word>& colours,
const word& surfaceType
)
{
......
......@@ -95,10 +95,10 @@ protected:
bool featureEdges_;
//- Surface colour
autoPtr<DataEntry<vector> > surfaceColour_;
autoPtr<Function1<vector>> surfaceColour_;
//- Edge colour
autoPtr<DataEntry<vector> > edgeColour_;
autoPtr<Function1<vector>> edgeColour_;
//- Surface actor
vtkSmartPointer<vtkActor> surfaceActor_;
......@@ -139,7 +139,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
),
(parent, dict, colours)
);
......@@ -152,7 +152,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
);
......@@ -163,7 +163,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours,
const HashPtrTable<Function1<vector>, word>& colours,
const word& surfaceName
);
......
......@@ -39,7 +39,7 @@ Foam::text::text
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
)
:
geometryBase(parent, dict, colours),
......@@ -51,7 +51,7 @@ Foam::text::text
{
if (dict.found("colour"))
{
colour_.reset(DataEntry<vector>::New("colour", dict).ptr());
colour_.reset(Function1<vector>::New("colour", dict).ptr());
}
else
{
......
......@@ -77,7 +77,7 @@ protected:
scalar size_;
//- Colour
autoPtr<DataEntry<vector> > colour_;
autoPtr<Function1<vector>> colour_;
//- Bold flag
bool bold_;
......@@ -92,7 +92,7 @@ public:
(
const runTimePostProcessing& parent,
const dictionary& dict,
const HashPtrTable<DataEntry<vector>, word>& colours
const HashPtrTable<Function1<vector>, word>& colours
);