Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
d2366604
Commit
d2366604
authored
Jul 03, 2008
by
Andrew Heather
Browse files
general clean-up, and renamed filename extension to avoid conflict with internal reader
parent
79a42523
Changes
14
Hide whitespace changes
Inline
Side-by-side
applications/utilities/postProcessing/graphics/PV3FoamReader/Allwclean
0 → 100755
View file @
d2366604
#!/bin/sh
set
-x
rm
-r
PV3FoamReader/Make
wclean libso vtkPV3Foam
applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx
View file @
d2366604
...
...
@@ -54,7 +54,7 @@ vtkPV3FoamReader::vtkPV3FoamReader()
{
Debug
=
0
;
vtkDebugMacro
(
<<
"Constructor"
);
SetNumberOfInputPorts
(
0
);
FileName
=
NULL
;
...
...
@@ -115,7 +115,6 @@ vtkPV3FoamReader::vtkPV3FoamReader()
vtkPV3FoamReader
::~
vtkPV3FoamReader
()
{
vtkDebugMacro
(
<<
"Deconstructor"
);
cout
<<
"Destroy ~vtkPV3FoamReader
\n
"
;
if
(
foamData_
)
{
...
...
@@ -152,23 +151,30 @@ int vtkPV3FoamReader::RequestInformation
)
{
vtkDebugMacro
(
<<
"RequestInformation"
);
cout
<<
"REQUEST_INFORMATION
\n
"
;
if
(
Foam
::
vtkPV3Foam
::
debug
)
{
cout
<<
"REQUEST_INFORMATION
\n
"
;
}
if
(
!
FileName
)
{
vtkErrorMacro
(
"FileName has to be specified!"
);
return
0
;
}
if
(
Foam
::
vtkPV3Foam
::
debug
)
{
vtkInformation
*
outputInfo
=
this
->
GetOutputPortInformation
(
0
);
outputInfo
->
Print
(
cout
);
vtkMultiBlockDataSet
*
output
=
vtkMultiBlockDataSet
::
SafeDownCast
(
outputInfo
->
Get
(
vtkMultiBlockDataSet
::
DATA_OBJECT
())
);
if
(
output
)
outputInfo
->
Print
(
cout
);
if
(
output
)
{
output
->
Print
(
cout
);
}
...
...
@@ -177,21 +183,19 @@ int vtkPV3FoamReader::RequestInformation
cout
<<
"no output
\n
"
;
}
cout
<<
"GetExecutive:
\n
"
;
this
->
GetExecutive
()
->
GetOutputInformation
(
0
)
->
Print
(
cout
);
}
{
int
nInfo
=
outputVector
->
GetNumberOfInformationObjects
();
cout
<<
"requestInfo with "
<<
nInfo
<<
" items
\n
"
;
cout
<<
"requestInfo with "
<<
nInfo
<<
" items:
\n
"
;
for
(
int
i
=
0
;
i
<
nInfo
;
i
++
)
{
vtkInformation
*
info
=
outputVector
->
GetInformationObject
(
i
);
info
->
Print
(
cout
);
}
}
vtkInformation
*
outInfo
=
outputVector
->
GetInformationObject
(
0
);
if
(
!
foamData_
)
...
...
@@ -207,15 +211,12 @@ int vtkPV3FoamReader::RequestInformation
else
{
vtkDebugMacro
(
"RequestInformation: updating information"
);
foamData_
->
UpdateInformation
();
}
int
nTimeSteps
=
0
;
double
*
timeSteps
=
foamData_
->
timeSteps
(
nTimeSteps
);
cout
<<
"Have nTimeSteps: "
<<
nTimeSteps
<<
"
\n
"
;
outInfo
->
Set
(
vtkStreamingDemandDrivenPipeline
::
TIME_STEPS
(),
...
...
@@ -229,13 +230,16 @@ int vtkPV3FoamReader::RequestInformation
timeRange
[
0
]
=
timeSteps
[
0
];
timeRange
[
1
]
=
timeSteps
[
nTimeSteps
-
1
];
cout
<<
"nTimeSteps "
<<
nTimeSteps
<<
"
\n
"
;
cout
<<
"timeRange "
<<
timeRange
[
0
]
<<
" -> "
<<
timeRange
[
1
]
<<
"
\n
"
;
if
(
Foam
::
vtkPV3Foam
::
debug
)
{
cout
<<
"nTimeSteps "
<<
nTimeSteps
<<
"
\n
"
;
cout
<<
"timeRange "
<<
timeRange
[
0
]
<<
" to "
<<
timeRange
[
1
]
<<
"
\n
"
;
// for (int i = 0; i < nTimeSteps; ++i)
// {
// cout<<"step[" << i << "] = " << timeSteps[i] << "\n";
// }
for
(
int
i
=
0
;
i
<
nTimeSteps
;
++
i
)
{
cout
<<
"step["
<<
i
<<
"] = "
<<
timeSteps
[
i
]
<<
"
\n
"
;
}
}
outInfo
->
Set
(
...
...
@@ -247,7 +251,6 @@ int vtkPV3FoamReader::RequestInformation
delete
timeSteps
;
cout
<<
"done RequestInformation
\n
"
;
return
1
;
}
...
...
@@ -261,21 +264,27 @@ int vtkPV3FoamReader::RequestData
)
{
vtkDebugMacro
(
<<
"RequestData"
);
cout
<<
"REQUEST_DATA
\n
"
;
if
(
!
FileName
)
{
vtkErrorMacro
(
"FileName has to be specified!"
);
return
0
;
}
{
int
nInfo
=
outputVector
->
GetNumberOfInformationObjects
();
cout
<<
"requestData with "
<<
nInfo
<<
" items
\n
"
;
if
(
Foam
::
vtkPV3Foam
::
debug
)
{
cout
<<
"requestData with "
<<
nInfo
<<
" items
\n
"
;
}
for
(
int
i
=
0
;
i
<
nInfo
;
i
++
)
{
vtkInformation
*
info
=
outputVector
->
GetInformationObject
(
i
);
info
->
Print
(
cout
);
if
(
Foam
::
vtkPV3Foam
::
debug
)
{
info
->
Print
(
cout
);
}
}
}
...
...
@@ -284,38 +293,38 @@ int vtkPV3FoamReader::RequestData
(
outInfo
->
Get
(
vtkMultiBlockDataSet
::
DATA_OBJECT
())
);
#if 1
if
(
Foam
::
vtkPV3Foam
::
debug
)
{
vtkInformation
*
outputInfo
=
this
->
GetOutputPortInformation
(
0
);
outputInfo
->
Print
(
cout
);
vtkMultiBlockDataSet
*
output
=
vtkMultiBlockDataSet
::
SafeDownCast
(
outputInfo
->
Get
(
vtkMultiBlockDataSet
::
DATA_OBJECT
())
);
if
(
output
)
if
(
output
)
{
output
->
Print
(
cout
);
}
else
{
cout
<<
"no output
\n
"
;
cout
<<
"no output
\n
"
;
}
vtkInformation
*
execInfo
=
this
->
GetExecutive
()
->
GetOutputInformation
(
0
);
execInfo
->
Print
(
cout
);
outInfo
->
Print
(
cout
);
vtkMultiBlockDataSet
*
dobj
=
vtkMultiBlockDataSet
::
SafeDownCast
(
outInfo
->
Get
(
vtkMultiBlockDataSet
::
DATA_OBJECT
())
);
if
(
dobj
)
if
(
dobj
)
{
dobj
->
Print
(
cout
);
vtkInformation
*
dobjInfo
=
dobj
->
GetInformation
();
dobjInfo
->
Print
(
cout
);
}
...
...
@@ -323,16 +332,16 @@ int vtkPV3FoamReader::RequestData
{
cout
<<
"no data_object
\n
"
;
}
}
#endif
if
(
outInfo
->
Has
(
vtkStreamingDemandDrivenPipeline
::
UPDATE_TIME_STEPS
()))
{
cout
<<
"Has UPDATE_TIME_STEPS
\n
"
;
cout
<<
"output->GetNumberOfBlocks() "
<<
output
->
GetNumberOfBlocks
()
<<
"
\n
"
;
if
(
Foam
::
vtkPV3Foam
::
debug
)
{
cout
<<
"Has UPDATE_TIME_STEPS
\n
"
;
cout
<<
"output->GetNumberOfBlocks() = "
<<
output
->
GetNumberOfBlocks
()
<<
"
\n
"
;
}
// Get the requested time step.
// We only supprt requests of a single time step
...
...
@@ -370,10 +379,6 @@ int vtkPV3FoamReader::RequestData
}
UpdateGUIOld
=
GetUpdateGUI
();
cout
<<
"done RequestData
\n
"
;
cout
<<
"done output->GetNumberOfBlocks() "
<<
output
->
GetNumberOfBlocks
()
<<
"
\n
"
;
return
1
;
}
...
...
applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C
View file @
d2366604
...
...
@@ -84,13 +84,15 @@ void Foam::vtkPV3Foam::AddToBlock
output
->
SetBlock
(
blockNo
,
block
);
block
->
Delete
();
}
if
(
block
)
else
{
Info
<<
"block["
<<
blockNo
<<
"] has "
<<
block
->
GetNumberOfBlocks
()
<<
" datasets prior to adding set "
<<
datasetNo
<<
" with name: "
<<
blockName
<<
endl
;
if
(
debug
)
{
Info
<<
"block["
<<
blockNo
<<
"] has "
<<
block
->
GetNumberOfBlocks
()
<<
" datasets prior to adding set "
<<
datasetNo
<<
" with name: "
<<
blockName
<<
endl
;
}
// when assigning dataset 0, also name the parent block
if
(
!
datasetNo
&&
selector
.
name
())
...
...
@@ -481,8 +483,11 @@ Foam::vtkPV3Foam::vtkPV3Foam
dbPtr_
().
functionObjects
().
off
();
cout
<<
"constructed with output: "
;
output_
->
Print
(
cout
),
if
(
debug
)
{
cout
<<
"constructed with output: "
;
output_
->
Print
(
cout
);
}
resetCounters
();
...
...
@@ -579,8 +584,8 @@ void Foam::vtkPV3Foam::Update
{
if
(
debug
)
{
Info
<<
"entered Foam::vtkPV3Foam::Update"
<<
endl
;
cout
<<
"Update
\n
"
;
cout
<<
"entered Foam::vtkPV3Foam::Update"
<<
nl
<<
"Update
\n
"
;
output
->
Print
(
cout
);
cout
<<
"Internally:
\n
"
;
...
...
applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H
View file @
d2366604
...
...
@@ -172,6 +172,7 @@ public:
}
};
private:
// Private data
...
...
@@ -645,85 +646,6 @@ public:
};
// * * * * * * * * * * * * * Template Specialisations * * * * * * * * * * * //
template
<
>
void
vtkPV3Foam
::
convertVolField
(
const
GeometricField
<
scalar
,
fvPatchField
,
volMesh
>&
sf
,
vtkMultiBlockDataSet
*
output
,
const
selectionInfo
&
,
const
label
datasetNo
,
labelList
&
superCells
);
template
<
>
void
vtkPV3Foam
::
convertPatchFaceField
(
const
word
&
name
,
const
Field
<
scalar
>&
,
vtkMultiBlockDataSet
*
output
,
const
selectionInfo
&
,
const
label
datasetNo
);
template
<
>
void
vtkPV3Foam
::
convertFaceField
(
const
GeometricField
<
scalar
,
fvPatchField
,
volMesh
>&
,
vtkMultiBlockDataSet
*
output
,
const
selectionInfo
&
,
const
label
datasetNo
,
const
fvMesh
&
,
const
labelList
&
faceLabels
);
template
<
>
void
vtkPV3Foam
::
convertFaceField
(
const
GeometricField
<
scalar
,
fvPatchField
,
volMesh
>&
,
vtkMultiBlockDataSet
*
output
,
const
selectionInfo
&
,
const
label
datasetNo
,
const
fvMesh
&
,
const
faceSet
&
);
template
<
>
void
vtkPV3Foam
::
convertPointField
(
const
GeometricField
<
scalar
,
pointPatchField
,
pointMesh
>&
,
const
GeometricField
<
scalar
,
fvPatchField
,
volMesh
>&
,
vtkMultiBlockDataSet
*
output
,
const
selectionInfo
&
,
const
label
datasetNo
);
template
<
>
void
vtkPV3Foam
::
convertPatchPointField
(
const
word
&
name
,
const
Field
<
scalar
>&
,
vtkMultiBlockDataSet
*
output
,
const
selectionInfo
&
,
const
label
datasetNo
);
template
<
>
void
vtkPV3Foam
::
convertLagrangianField
(
const
IOField
<
scalar
>&
,
vtkMultiBlockDataSet
*
output
,
const
selectionInfo
&
,
const
label
datasetNo
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
...
...
applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamConvertFaceField.H
View file @
d2366604
...
...
@@ -48,6 +48,8 @@ void Foam::vtkPV3Foam::convertFaceField
const
labelList
&
faceLabels
)
{
const
label
nComp
=
pTraits
<
Type
>::
nComponents
;
vtkPolyData
*
vtkmesh
=
vtkPolyData
::
SafeDownCast
(
GetDataSetFromBlock
(
output
,
selector
,
datasetNo
)
...
...
@@ -59,33 +61,30 @@ void Foam::vtkPV3Foam::convertFaceField
vtkFloatArray
*
cellData
=
vtkFloatArray
::
New
();
cellData
->
SetNumberOfTuples
(
faceLabels
.
size
());
cellData
->
SetNumberOfComponents
(
Type
::
nComponents
);
cellData
->
Allocate
(
Type
::
nComponents
*
faceLabels
.
size
());
cellData
->
SetNumberOfComponents
(
nComp
);
cellData
->
Allocate
(
nComp
*
faceLabels
.
size
());
cellData
->
SetName
(
tf
.
name
().
c_str
());
float
vec
[
Type
::
nComponents
];
float
vec
[
nComp
];
forAll
(
faceLabels
,
faceI
)
{
const
label
faceNo
=
faceLabels
[
faceI
];
if
(
faceNo
<
nInternalFaces
)
{
Type
t
=
0.5
*
(
tf
[
faceOwner
[
faceNo
]]
+
tf
[
faceNeigh
[
faceNo
]]
);
Type
t
=
0.5
*
(
tf
[
faceOwner
[
faceNo
]]
+
tf
[
faceNeigh
[
faceNo
]]);
for
(
direction
d
=
0
;
d
<
Type
::
nComponents
;
d
++
)
for
(
direction
d
=
0
;
d
<
nComp
;
d
++
)
{
vec
[
d
]
=
t
[
d
]
;
vec
[
d
]
=
component
(
t
,
d
)
;
}
}
else
{
const
Type
&
t
=
tf
[
faceOwner
[
faceNo
]];
for
(
direction
d
=
0
;
d
<
Type
::
nComponents
;
d
++
)
for
(
direction
d
=
0
;
d
<
nComp
;
d
++
)
{
vec
[
d
]
=
t
[
d
]
;
vec
[
d
]
=
component
(
t
,
d
)
;
}
}
...
...
@@ -108,6 +107,8 @@ void Foam::vtkPV3Foam::convertFaceField
const
faceSet
&
fSet
)
{
const
label
nComp
=
pTraits
<
Type
>::
nComponents
;
vtkPolyData
*
vtkmesh
=
vtkPolyData
::
SafeDownCast
(
GetDataSetFromBlock
(
output
,
selector
,
datasetNo
)
...
...
@@ -119,11 +120,11 @@ void Foam::vtkPV3Foam::convertFaceField
vtkFloatArray
*
cellData
=
vtkFloatArray
::
New
();
cellData
->
SetNumberOfTuples
(
fSet
.
size
());
cellData
->
SetNumberOfComponents
(
Type
::
nComponents
);
cellData
->
Allocate
(
Type
::
nComponents
*
fSet
.
size
());
cellData
->
SetNumberOfComponents
(
nComp
);
cellData
->
Allocate
(
nComp
*
fSet
.
size
());
cellData
->
SetName
(
tf
.
name
().
c_str
());
float
vec
[
Type
::
nComponents
];
float
vec
[
nComp
];
label
faceI
=
0
;
forAllConstIter
(
faceSet
,
fSet
,
iter
)
...
...
@@ -132,22 +133,19 @@ void Foam::vtkPV3Foam::convertFaceField
if
(
faceNo
<
nInternalFaces
)
{
Type
t
=
0.5
*
(
tf
[
faceOwner
[
faceNo
]]
+
tf
[
faceNeigh
[
faceNo
]]
);
Type
t
=
0.5
*
(
tf
[
faceOwner
[
faceNo
]]
+
tf
[
faceNeigh
[
faceNo
]]);
for
(
direction
d
=
0
;
d
<
Type
::
nComponents
;
d
++
)
for
(
direction
d
=
0
;
d
<
nComp
;
d
++
)
{
vec
[
d
]
=
t
[
d
]
;
vec
[
d
]
=
component
(
t
,
d
)
;
}
}
else
{
const
Type
&
t
=
tf
[
faceOwner
[
faceNo
]];
for
(
direction
d
=
0
;
d
<
Type
::
nComponents
;
d
++
)
for
(
direction
d
=
0
;
d
<
nComp
;
d
++
)
{
vec
[
d
]
=
t
[
d
]
;
vec
[
d
]
=
component
(
t
,
d
)
;
}
}
...
...
@@ -160,125 +158,6 @@ void Foam::vtkPV3Foam::convertFaceField
}
template
<
>
void
Foam
::
vtkPV3Foam
::
convertFaceField
(
const
GeometricField
<
scalar
,
fvPatchField
,
volMesh
>&
tf
,
vtkMultiBlockDataSet
*
output
,
const
selectionInfo
&
selector
,
const
label
datasetNo
,
const
fvMesh
&
mesh
,
const
labelList
&
faceLabels
)
{
vtkPolyData
*
vtkmesh
=
vtkPolyData
::
SafeDownCast
(
GetDataSetFromBlock
(
output
,
selector
,
datasetNo
)
);
const
label
nInternalFaces
=
mesh
.
nInternalFaces
();
const
labelList
&
faceOwner
=
mesh
.
faceOwner
();
const
labelList
&
faceNeigh
=
mesh
.
faceNeighbour
();
vtkFloatArray
*
cellData
=
vtkFloatArray
::
New
();
cellData
->
SetNumberOfTuples
(
faceLabels
.
size
());
cellData
->
SetNumberOfComponents
(
1
);
cellData
->
Allocate
(
faceLabels
.
size
());
cellData
->
SetName
(
tf
.
name
().
c_str
());
forAll
(
faceLabels
,
faceI
)
{
const
label
faceNo
=
faceLabels
[
faceI
];
if
(
faceNo
<
nInternalFaces
)
{
cellData
->
InsertComponent
(
faceI
,
0
,
0.5
*
(
tf
[
faceOwner
[
faceNo
]]
+
tf
[
faceNeigh
[
faceNo
]])
);
}
else
{
cellData
->
InsertComponent
(
faceI
,
0
,
tf
[
faceOwner
[
faceNo
]]
);
}
}
vtkmesh
->
GetCellData
()
->
AddArray
(
cellData
);
if
(
!
vtkmesh
->
GetCellData
()
->
GetScalars
())
{
vtkmesh
->
GetCellData
()
->
SetScalars
(
cellData
);
}
cellData
->
Delete
();
}
template
<
>
void
Foam
::
vtkPV3Foam
::
convertFaceField
(
const
GeometricField
<
scalar
,
fvPatchField
,
volMesh
>&
tf
,
vtkMultiBlockDataSet
*
output
,
const
selectionInfo
&
selector
,
const
label
datasetNo
,
const
fvMesh
&
mesh
,
const
faceSet
&
fSet
)
{
vtkPolyData
*
vtkmesh
=
vtkPolyData
::
SafeDownCast
(
GetDataSetFromBlock
(
output
,
selector
,
datasetNo
)
);
const
label
nInternalFaces
=
mesh
.
nInternalFaces
();
const
labelList
&
faceOwner
=
mesh
.
faceOwner
();
const
labelList
&
faceNeigh
=
mesh
.
faceNeighbour
();
vtkFloatArray
*
cellData
=
vtkFloatArray
::
New
();
cellData
->
SetNumberOfTuples
(
fSet
.
size
());
cellData
->
SetNumberOfComponents
(
1
);
cellData
->
Allocate
(
fSet
.
size
());
cellData
->
SetName