Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Modules
Visualization
Commits
5751bd39
Commit
5751bd39
authored
Oct 05, 2009
by
Mark Olesen
Browse files
PV3FoamReader - cosmetic changes
parent
3e90b86b
Changes
13
Hide whitespace changes
Inline
Side-by-side
src/paraview-plugins/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml
View file @
5751bd39
...
...
@@ -106,7 +106,7 @@
animateable=
"0"
>
<BooleanDomain
name=
"bool"
/>
<Documentation>
A simple way cause a reader GUI modification.
A simple way
to
cause a reader GUI modification.
</Documentation>
</IntVectorProperty>
...
...
src/paraview-plugins/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx
View file @
5751bd39
...
...
@@ -385,14 +385,7 @@ int vtkPV3FoamReader::RequestData
foamData_
->
Update
(
output
,
output
);
#endif
if
(
ShowPatchNames
)
{
addPatchNamesToView
();
}
else
{
removePatchNamesFromView
();
}
updatePatchNamesView
(
ShowPatchNames
);
#endif
...
...
@@ -403,27 +396,7 @@ int vtkPV3FoamReader::RequestData
}
void
vtkPV3FoamReader
::
addPatchNamesToView
()
{
pqApplicationCore
*
appCore
=
pqApplicationCore
::
instance
();
// Server manager model for querying items in the server manager
pqServerManagerModel
*
smModel
=
appCore
->
getServerManagerModel
();
// Get all the pqRenderView instances
QList
<
pqRenderView
*>
renderViews
=
smModel
->
findItems
<
pqRenderView
*>
();
for
(
int
viewI
=
0
;
viewI
<
renderViews
.
size
();
viewI
++
)
{
foamData_
->
addPatchNames
(
renderViews
[
viewI
]
->
getRenderViewProxy
()
->
GetRenderer
()
);
}
}
void
vtkPV3FoamReader
::
removePatchNamesFromView
()
void
vtkPV3FoamReader
::
updatePatchNamesView
(
const
bool
show
)
{
pqApplicationCore
*
appCore
=
pqApplicationCore
::
instance
();
...
...
@@ -435,9 +408,10 @@ void vtkPV3FoamReader::removePatchNamesFromView()
for
(
int
viewI
=
0
;
viewI
<
renderViews
.
size
();
viewI
++
)
{
foamData_
->
re
move
PatchNames
foamData_
->
re
nder
PatchNames
(
renderViews
[
viewI
]
->
getRenderViewProxy
()
->
GetRenderer
()
renderViews
[
viewI
]
->
getRenderViewProxy
()
->
GetRenderer
(),
show
);
}
}
...
...
src/paraview-plugins/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h
View file @
5751bd39
...
...
@@ -174,11 +174,8 @@ private:
//- Disallow default bitwise assignment
void
operator
=
(
const
vtkPV3FoamReader
&
);
//- Add patch names to the view
void
addPatchNamesToView
();
//- Remove patch names from the view
void
removePatchNamesFromView
();
//- Add/remove patch names to/from the view
void
updatePatchNamesView
(
const
bool
show
);
int
TimeStepRange
[
2
];
int
CacheMesh
;
...
...
src/paraview-plugins/PV3FoamReader/vtkPV3Foam/vtk
PV3Foam
Points.H
→
src/paraview-plugins/PV3FoamReader/vtkPV3Foam/vtk
OpenFOAM
Points.H
View file @
5751bd39
...
...
@@ -27,15 +27,15 @@ InClass
\*---------------------------------------------------------------------------*/
#ifndef vtk
PV3Foam
Points_H
#define vtk
PV3Foam
Points_H
#ifndef vtk
OpenFOAM
Points_H
#define vtk
OpenFOAM
Points_H
// VTK includes
#include "vtkPoints.h"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline
void
vtk
PV3Foam
InsertNextPoint
inline
void
vtkInsertNext
OpenFOAM
Point
(
vtkPoints
*
points
,
const
Foam
::
point
&
p
...
...
@@ -46,7 +46,7 @@ inline void vtkPV3FoamInsertNextPoint
#if 0
// this should be faster, but didn't get it working ...
inline void vtk
PV3FoamSet
Point
inline void vtk
SetOpenFOAM
Point
(
vtkPoints *points,
const Foam::label id,
...
...
@@ -58,7 +58,7 @@ inline void vtkPV3FoamSetPoint
// Convert Foam mesh vertices to VTK
inline vtkPoints* vtk
PV3FoamVTK
Points(const Foam::pointField& points)
inline vtkPoints* vtk
SetOpenFOAM
Points(const Foam::pointField& points)
{
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->SetNumberOfPoints(points.size());
...
...
src/paraview-plugins/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C
View file @
5751bd39
...
...
@@ -590,219 +590,203 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps)
}
void
Foam
::
vtkPV3Foam
::
add
PatchNames
(
vtkRenderer
*
renderer
)
void
Foam
::
vtkPV3Foam
::
render
PatchNames
(
vtkRenderer
*
renderer
,
const
bool
show
)
{
// Remove any patch names previously added to the renderer
removePatchNames
(
renderer
);
// always remove old actors first
// get the display patches, strip off any suffix
wordHashSet
selectedPatches
=
getSelected
(
reader_
->
GetPartSelection
(),
partInfoPatches_
);
if
(
!
selectedPatches
.
size
())
forAll
(
patchTextActorsPtrs_
,
patchI
)
{
return
;
renderer
->
RemoveViewProp
(
patchTextActorsPtrs_
[
patchI
]);
patchTextActorsPtrs_
[
patchI
]
->
Delete
();
}
patchTextActorsPtrs_
.
clear
();
if
(
debug
)
if
(
show
)
{
Info
<<
"<beg> Foam::vtkPV3Foam::addPatchNames"
<<
nl
<<
"... add patches: "
<<
selectedPatches
<<
endl
;
}
// get the display patches, strip off any suffix
wordHashSet
selectedPatches
=
getSelected
(
reader_
->
GetPartSelection
(),
partInfoPatches_
);
const
polyBoundaryMesh
&
pbMesh
=
meshPtr_
->
boundaryMesh
();
if
(
!
selectedPatches
.
size
())
{
return
;
}
// Find the total number of zones
// Each zone will take the patch name
// Number of zones per patch ... zero zones should be skipped
labelList
nZones
(
pbMesh
.
size
(),
0
);
const
polyBoundaryMesh
&
pbMesh
=
meshPtr_
->
boundaryMesh
();
// Per global zone number the average face centre position
DynamicList
<
point
>
zoneCentre
(
pbMesh
.
size
());
// Find the total number of zones
// Each zone will take the patch name
// Number of zones per patch ... zero zones should be skipped
labelList
nZones
(
pbMesh
.
size
(),
0
);
if
(
debug
)
{
Info
<<
"... determining patch zones"
<<
endl
;
}
// Per global zone number the average face centre position
DynamicList
<
point
>
zoneCentre
(
pbMesh
.
size
());
// Loop through all patches to determine zones, and centre of each zone
forAll
(
pbMesh
,
patchI
)
{
const
polyPatch
&
pp
=
pbMesh
[
patchI
];
//
Only include the patch if it is selected
if
(
!
selectedPatches
.
found
(
pp
.
name
())
)
//
Loop through all patches to determine zones, and centre of each zone
forAll
(
pbMesh
,
patchI
)
{
continue
;
}
const
polyPatch
&
pp
=
pbMesh
[
patchI
];
const
labelListList
&
edgeFaces
=
pp
.
edgeFaces
();
const
vectorField
&
n
=
pp
.
faceNormals
();
// Only include the patch if it is selected
if
(
!
selectedPatches
.
found
(
pp
.
name
()))
{
continue
;
}
boolList
featEdge
(
pp
.
nEdges
(),
false
);
const
labelListList
&
edgeFaces
=
pp
.
edgeFaces
();
const
vectorField
&
n
=
pp
.
faceNormals
();
forAll
(
edgeFaces
,
edgeI
)
{
const
labelList
&
eFaces
=
edgeFaces
[
edgeI
];
boolList
featEdge
(
pp
.
nEdges
(),
false
);
if
(
eFaces
.
size
()
==
1
)
forAll
(
edgeFaces
,
edgeI
)
{
// Note: could also do ones with > 2 faces but this gives
// too many zones for baffles
featEdge
[
edgeI
]
=
true
;
const
labelList
&
eFaces
=
edgeFaces
[
edgeI
];
if
(
eFaces
.
size
()
==
1
)
{
// Note: could also do ones with > 2 faces but this gives
// too many zones for baffles
featEdge
[
edgeI
]
=
true
;
}
else
if
(
mag
(
n
[
eFaces
[
0
]]
&
n
[
eFaces
[
1
]])
<
0
.
5
)
{
featEdge
[
edgeI
]
=
true
;
}
}
else
if
(
mag
(
n
[
eFaces
[
0
]]
&
n
[
eFaces
[
1
]])
<
0
.
5
)
{
featEdge
[
edgeI
]
=
true
;
}
}
// Do topological analysis of patch, find disconnected regions
patchZones
pZones
(
pp
,
featEdge
);
// Do topological analysis of patch, find disconnected regions
patchZones
pZones
(
pp
,
featEdge
);
nZones
[
patchI
]
=
pZones
.
nZones
();
nZones
[
patchI
]
=
pZones
.
nZones
();
labelList
zoneNFaces
(
pZones
.
nZones
(),
0
);
labelList
zoneNFaces
(
pZones
.
nZones
(),
0
);
// Save start of information for current patch
label
patchStart
=
zoneCentre
.
size
();
// Save start of information for current patch
label
patchStart
=
zoneCentre
.
size
();
// Create storage for additional zone centres
forAll
(
zoneNFaces
,
zoneI
)
{
zoneCentre
.
append
(
vector
::
zero
);
}
// Create storage for additional zone centres
forAll
(
zoneNFaces
,
zoneI
)
{
zoneCentre
.
append
(
vector
::
zero
);
}
// Do averaging per individual zone
forAll
(
pp
,
faceI
)
{
label
zoneI
=
pZones
[
faceI
];
zoneCentre
[
patchStart
+
zoneI
]
+=
pp
[
faceI
].
centre
(
pp
.
points
());
zoneNFaces
[
zoneI
]
++
;
}
// Do averaging per individual zone
forAll
(
pp
,
faceI
)
{
label
zoneI
=
pZones
[
faceI
];
zoneCentre
[
patchStart
+
zoneI
]
+=
pp
[
faceI
].
centre
(
pp
.
points
());
zoneNFaces
[
zoneI
]
++
;
}
for
(
label
i
=
0
;
i
<
nZones
[
patchI
];
i
++
)
{
zoneCentre
[
patchStart
+
i
]
/=
zoneNFaces
[
i
];
for
(
label
i
=
0
;
i
<
nZones
[
patchI
];
i
++
)
{
zoneCentre
[
patchStart
+
i
]
/=
zoneNFaces
[
i
];
}
}
}
// Count number of zones we're actually going to display. This is truncated
// to a max per patch
const
label
MAXPATCHZONES
=
20
;
// Count number of zones we're actually going to display. This is truncated
// to a max per patch
label
displayZoneI
=
0
;
const
label
MAXPATCHZONES
=
2
0
;
forAll
(
pbMesh
,
patchI
)
{
displayZoneI
+=
min
(
MAXPATCHZONES
,
nZones
[
patchI
]);
}
label
displayZoneI
=
0
;
forAll
(
pbMesh
,
patchI
)
{
displayZoneI
+=
min
(
MAXPATCHZONES
,
nZones
[
patchI
]);
}
zoneCentre
.
shrink
();
if
(
debug
)
{
Info
<<
"patch zone centres = "
<<
zoneCentre
<<
nl
<<
"displayed zone centres = "
<<
displayZoneI
<<
nl
<<
"zones per patch = "
<<
nZones
<<
endl
;
}
zoneCentre
.
shrink
();
// Set the size of the patch labels to max number of zones
patchTextActorsPtrs_
.
setSize
(
displayZoneI
);
if
(
debug
)
{
Info
<<
"patch zone centres = "
<<
zoneCentre
<<
nl
<<
"displayed zone centres = "
<<
displayZoneI
<<
nl
<<
"zones per patch = "
<<
nZones
<<
endl
;
}
if
(
debug
)
{
Info
<<
"constructing patch labels"
<<
endl
;
}
// Set the size of the patch labels to max number of zones
patchTextActorsPtrs_
.
setSize
(
displayZoneI
);
// Actor index
displayZoneI
=
0
;
if
(
debug
)
{
Info
<<
"constructing patch labels"
<<
endl
;
}
// Index in zone centres
label
global
ZoneI
=
0
;
// Actor index
display
ZoneI
=
0
;
forAll
(
pbMesh
,
patchI
)
{
const
polyPatch
&
pp
=
pbMesh
[
patchI
];
// Index in zone centres
label
globalZoneI
=
0
;
// Only selected patches will have a non-zero number of zones
label
nDisplayZones
=
min
(
MAXPATCHZONES
,
nZones
[
patchI
]);
label
increment
=
1
;
if
(
nZones
[
patchI
]
>=
MAXPATCHZONES
)
forAll
(
pbMesh
,
patchI
)
{
increment
=
nZones
[
patchI
]
/
MAXPATCHZONES
;
}
const
polyPatch
&
pp
=
pbMesh
[
patchI
];
for
(
label
i
=
0
;
i
<
nDisplayZones
;
i
++
)
{
if
(
debug
)
// Only selected patches will have a non-zero number of zones
label
nDisplayZones
=
min
(
MAXPATCHZONES
,
nZones
[
patchI
]);
label
increment
=
1
;
if
(
nZones
[
patchI
]
>=
MAXPATCHZONES
)
{
Info
<<
"patch name = "
<<
pp
.
name
()
<<
nl
<<
"anchor = "
<<
zoneCentre
[
globalZoneI
]
<<
nl
<<
"globalZoneI = "
<<
globalZoneI
<<
endl
;
increment
=
nZones
[
patchI
]
/
MAXPATCHZONES
;
}
vtkTextActor
*
txt
=
vtkTextActor
::
New
();
txt
->
SetInput
(
pp
.
name
().
c_str
());
// Set text properties
vtkTextProperty
*
tprop
=
txt
->
GetTextProperty
();
tprop
->
SetFontFamilyToArial
();
tprop
->
BoldOff
();
tprop
->
ShadowOff
();
tprop
->
SetLineSpacing
(
1
.
0
);
tprop
->
SetFontSize
(
12
);
tprop
->
SetColor
(
1
.
0
,
0
.
0
,
0
.
0
);
tprop
->
SetJustificationToCentered
();
// Set text to use 3-D world co-ordinates
txt
->
GetPositionCoordinate
()
->
SetCoordinateSystemToWorld
();
txt
->
GetPositionCoordinate
()
->
SetValue
(
zoneCentre
[
globalZoneI
].
x
(),
zoneCentre
[
globalZoneI
].
y
(),
zoneCentre
[
globalZoneI
].
z
()
);
// Add text to each renderer
renderer
->
AddViewProp
(
txt
);
// Maintain a list of text labels added so that they can be
// removed later
patchTextActorsPtrs_
[
displayZoneI
]
=
txt
;
globalZoneI
+=
increment
;
displayZoneI
++
;
for
(
label
i
=
0
;
i
<
nDisplayZones
;
i
++
)
{
if
(
debug
)
{
Info
<<
"patch name = "
<<
pp
.
name
()
<<
nl
<<
"anchor = "
<<
zoneCentre
[
globalZoneI
]
<<
nl
<<
"globalZoneI = "
<<
globalZoneI
<<
endl
;
}
vtkTextActor
*
txt
=
vtkTextActor
::
New
();
txt
->
SetInput
(
pp
.
name
().
c_str
());
// Set text properties
vtkTextProperty
*
tprop
=
txt
->
GetTextProperty
();
tprop
->
SetFontFamilyToArial
();
tprop
->
BoldOff
();
tprop
->
ShadowOff
();
tprop
->
SetLineSpacing
(
1
.
0
);
tprop
->
SetFontSize
(
12
);
tprop
->
SetColor
(
1
.
0
,
0
.
0
,
0
.
0
);
tprop
->
SetJustificationToCentered
();
// Set text to use 3-D world co-ordinates
txt
->
GetPositionCoordinate
()
->
SetCoordinateSystemToWorld
();
txt
->
GetPositionCoordinate
()
->
SetValue
(
zoneCentre
[
globalZoneI
].
x
(),
zoneCentre
[
globalZoneI
].
y
(),
zoneCentre
[
globalZoneI
].
z
()
);
// Add text to each renderer
renderer
->
AddViewProp
(
txt
);
// Maintain a list of text labels added so that they can be
// removed later
patchTextActorsPtrs_
[
displayZoneI
]
=
txt
;
globalZoneI
+=
increment
;
displayZoneI
++
;
}
}
}
// Resize the patch names list to the actual number of patch names added
patchTextActorsPtrs_
.
setSize
(
displayZoneI
);
if
(
debug
)
{
Info
<<
"<end> Foam::vtkPV3Foam::addPatchNames"
<<
endl
;
// Resize the patch names list to the actual number of patch names added
patchTextActorsPtrs_
.
setSize
(
displayZoneI
);
}
}
void
Foam
::
vtkPV3Foam
::
removePatchNames
(
vtkRenderer
*
renderer
)
{
forAll
(
patchTextActorsPtrs_
,
patchI
)
{
renderer
->
RemoveViewProp
(
patchTextActorsPtrs_
[
patchI
]);
patchTextActorsPtrs_
[
patchI
]
->
Delete
();
}
patchTextActorsPtrs_
.
clear
();
}
void
Foam
::
vtkPV3Foam
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
const
{
...
...
src/paraview-plugins/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H
View file @
5751bd39
...
...
@@ -31,7 +31,6 @@ Description
SourceFiles
vtkPV3Foam.C
vtkPV3Foam.H
vtkPV3FoamI.H
vtkPV3FoamFields.C
vtkPV3FoamMesh.C
vtkPV3FoamMeshLagrangian.C
...
...
@@ -627,9 +626,6 @@ class vtkPV3Foam
// GUI selection helper functions
//- Extract up to the first non-word characters
inline
static
word
getFirstWord
(
const
char
*
);
//- Only keep what is listed in hashSet
static
void
pruneObjectList
(
...
...
@@ -715,11 +711,8 @@ public:
// returns the count via the parameter
double
*
findTimes
(
int
&
nTimeSteps
);
//- Add patch names to the display
void
addPatchNames
(
vtkRenderer
*
renderer
);
//- Remove patch names from the display
void
removePatchNames
(
vtkRenderer
*
renderer
);
//- Add/remove patch names to/from the view
void
renderPatchNames
(
vtkRenderer
*
,
const
bool
show
);
//- set the runTime to the first plausible request time,
// returns the timeIndex
...
...
@@ -751,8 +744,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
# include "vtkPV3FoamI.H"
#endif
// ************************************************************************* //
src/paraview-plugins/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H
deleted
100644 → 0
View file @
3e90b86b
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline
Foam
::
word
Foam
::
vtkPV3Foam
::
getFirstWord
(
const
char
*
str
)
{
if
(
str
)
{
label
n
=
0
;
while
(
str
[
n
]
&&
word
::
valid
(
str
[
n
]))
{
++
n
;
}
return
word
(
str
,
n
,
true
);
}
else
{
return
word
::
null
;
}
}
// ************************************************************************* //
src/paraview-plugins/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C
View file @
5751bd39
...
...
@@ -33,7 +33,7 @@ Description
#include "fvMesh.H"
#include "IOobjectList.H"
#include "passiveParticle.H"
#include "vtk
PV3Foam
Points.H"
#include "vtk
OpenFOAM
Points.H"
// VTK includes
#include "vtkCellArray.h"
...
...
@@ -86,7 +86,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
vtkIdType
particleId
=
0
;
forAllConstIter
(
Cloud
<
passiveParticle
>
,
parcels
,
iter
)
{
vtk
PV3Foam
InsertNextPoint
(
vtkpoints
,
iter
().
position
());
vtkInsertNext
OpenFOAM
Point
(
vtkpoints
,
iter
().
position
());
vtkcells
->
InsertNextCell
(
1
,
&
particleId
);
particleId
++
;
...
...
src/paraview-plugins/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C