ENH: use volume field name for interpolated fields

- avoids things like "volPointInterpolate(U)", but will likely cause
  issues when used together with identically named Lagrangian fields!
This commit is contained in:
Mark Olesen
2010-06-28 09:24:14 +02:00
parent 824e5eeb2b
commit aec1bace6c
3 changed files with 26 additions and 16 deletions

View File

@ -594,20 +594,22 @@ class vtkPV3Foam
vtkMultiBlockDataSet* output vtkMultiBlockDataSet* output
); );
//- Point field - all selected parts //- Point field - all selected parts, use specified display name
template<class Type> template<class Type>
void convertPointFieldBlock void convertPointFieldBlock
( (
const word& displayName,
const GeometricField<Type, pointPatchField, pointMesh>&, const GeometricField<Type, pointPatchField, pointMesh>&,
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
const arrayRange&, const arrayRange&,
const List<polyDecomp>& const List<polyDecomp>&
); );
//- Point fields //- Point field, use specified display name
template<class Type> template<class Type>
void convertPointField void convertPointField
( (
const word& displayName,
const GeometricField<Type, pointPatchField, pointMesh>&, const GeometricField<Type, pointPatchField, pointMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&, const GeometricField<Type, fvPatchField, volMesh>&,
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
@ -616,11 +618,11 @@ class vtkPV3Foam
const polyDecomp& const polyDecomp&
); );
//- Patch point field //- Patch point field, use specified display name
template<class Type> template<class Type>
void convertPatchPointField void convertPatchPointField
( (
const word& name, const word& displayName,
const Field<Type>&, const Field<Type>&,
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
const arrayRange&, const arrayRange&,

View File

@ -76,6 +76,7 @@ void Foam::vtkPV3Foam::convertPointFields
// Convert activated internalMesh regions // Convert activated internalMesh regions
convertPointFieldBlock convertPointFieldBlock
( (
fieldName,
ptf, ptf,
output, output,
arrayRangeVolume_, arrayRangeVolume_,
@ -85,6 +86,7 @@ void Foam::vtkPV3Foam::convertPointFields
// Convert activated cellZones // Convert activated cellZones
convertPointFieldBlock convertPointFieldBlock
( (
fieldName,
ptf, ptf,
output, output,
arrayRangeCellZones_, arrayRangeCellZones_,
@ -94,6 +96,7 @@ void Foam::vtkPV3Foam::convertPointFields
// Convert activated cellSets // Convert activated cellSets
convertPointFieldBlock convertPointFieldBlock
( (
fieldName,
ptf, ptf,
output, output,
arrayRangeCellSets_, arrayRangeCellSets_,
@ -136,6 +139,7 @@ void Foam::vtkPV3Foam::convertPointFields
template<class Type> template<class Type>
void Foam::vtkPV3Foam::convertPointFieldBlock void Foam::vtkPV3Foam::convertPointFieldBlock
( (
const word& displayName,
const GeometricField<Type, pointPatchField, pointMesh>& ptf, const GeometricField<Type, pointPatchField, pointMesh>& ptf,
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
const arrayRange& range, const arrayRange& range,
@ -150,6 +154,7 @@ void Foam::vtkPV3Foam::convertPointFieldBlock
{ {
convertPointField convertPointField
( (
displayName,
ptf, ptf,
GeometricField<Type, fvPatchField, volMesh>::null(), GeometricField<Type, fvPatchField, volMesh>::null(),
output, output,
@ -165,6 +170,7 @@ void Foam::vtkPV3Foam::convertPointFieldBlock
template<class Type> template<class Type>
void Foam::vtkPV3Foam::convertPointField void Foam::vtkPV3Foam::convertPointField
( (
const word& displayName,
const GeometricField<Type, pointPatchField, pointMesh>& ptf, const GeometricField<Type, pointPatchField, pointMesh>& ptf,
const GeometricField<Type, fvPatchField, volMesh>& tf, const GeometricField<Type, fvPatchField, volMesh>& tf,
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
@ -192,7 +198,7 @@ void Foam::vtkPV3Foam::convertPointField
pointData->SetNumberOfTuples(nPoints + addPointCellLabels.size()); pointData->SetNumberOfTuples(nPoints + addPointCellLabels.size());
pointData->SetNumberOfComponents(nComp); pointData->SetNumberOfComponents(nComp);
pointData->Allocate(nComp*(nPoints + addPointCellLabels.size())); pointData->Allocate(nComp*(nPoints + addPointCellLabels.size()));
pointData->SetName(ptf.name().c_str()); pointData->SetName(displayName.c_str());
if (debug) if (debug)
{ {

View File

@ -113,8 +113,7 @@ void Foam::vtkPV3Foam::convertVolFields
// The name for the interpolated patch point field must be consistent // The name for the interpolated patch point field must be consistent
// with the interpolated volume point field. // with the interpolated volume point field.
// This could be done better. const word& pointFldName = tf.name();
const word pointFldName = "volPointInterpolate(" + tf.name() + ')';
for for
( (
@ -276,21 +275,14 @@ void Foam::vtkPV3Foam::convertVolFieldBlock
const List<polyDecomp>& decompLst const List<polyDecomp>& decompLst
) )
{ {
const word& pointFldName = tf.name();
for (int partId = range.start(); partId < range.end(); ++partId) for (int partId = range.start(); partId < range.end(); ++partId)
{ {
const label datasetNo = partDataset_[partId]; const label datasetNo = partDataset_[partId];
if (datasetNo >= 0 && partStatus_[partId]) if (datasetNo >= 0 && partStatus_[partId])
{ {
convertVolField
(
tf,
output,
range,
datasetNo,
decompLst[datasetNo]
);
if (!ptfPtr.valid()) if (!ptfPtr.valid())
{ {
if (debug) if (debug)
@ -305,8 +297,18 @@ void Foam::vtkPV3Foam::convertVolFieldBlock
); );
} }
convertVolField
(
tf,
output,
range,
datasetNo,
decompLst[datasetNo]
);
convertPointField convertPointField
( (
pointFldName,
ptfPtr(), ptfPtr(),
tf, tf,
output, output,