vtkFoamConvertFields.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef vtkFoamConvertFields_H
00031 #define vtkFoamConvertFields_H
00032
00033
00034
00035 #include "vtkFoamConvertVolField.H"
00036 #include "vtkFoamConvertPointField.H"
00037
00038 #include "vtkFoamConvertPatchFaceField.H"
00039 #include "vtkFoamConvertPatchPointField.H"
00040
00041 #include "emptyFvPatchField.H"
00042
00043 template<class Type>
00044 void Foam::vtkFoam::convertVolFields
00045 (
00046 const fvMesh& mesh,
00047 const volPointInterpolation& pInterp,
00048 const IOobjectList& objects,
00049 vtkDataArraySelection *fieldSelection
00050 )
00051 {
00052 IOobjectList fieldObjects
00053 (
00054 objects.lookupClass
00055 (
00056 GeometricField<Type, fvPatchField, volMesh>::typeName
00057 )
00058 );
00059
00060 label nSelectedFields = fieldSelection->GetNumberOfArrays();
00061
00062 for (label i=0; i<nSelectedFields; i++)
00063 {
00064 if(fieldSelection->GetArraySetting(i))
00065 {
00066 word fieldName = fieldSelection->GetArrayName(i);
00067
00068 if (fieldObjects.found(fieldName))
00069 {
00070 GeometricField<Type, fvPatchField, volMesh> tf
00071 (
00072 IOobject
00073 (
00074 fieldName,
00075 mesh.time().timeName(),
00076 mesh,
00077 IOobject::MUST_READ
00078 ),
00079 mesh
00080 );
00081
00082 tmp<GeometricField<Type, pointPatchField, pointMesh> > tptf
00083 (
00084 pInterp.interpolate(tf)
00085 );
00086
00087 if (selectedRegions_[0])
00088 {
00089 convertVolField(tf);
00090 convertPointField(tptf(), tf);
00091 }
00092
00093 label regioni = 0;
00094 forAll (mesh.boundaryMesh(), patchi)
00095 {
00096 if (mesh.boundaryMesh()[patchi].size())
00097 {
00098 regioni++;
00099
00100 if (selectedRegions_[regioni])
00101 {
00102 const fvPatchField<Type>& ptf
00103 (
00104 tf.boundaryField()[patchi]
00105 );
00106
00107 if (!isType<emptyFvPatchField<Type> >(ptf))
00108 {
00109 convertPatchFaceField
00110 (
00111 tf.name(),
00112 ptf,
00113 regioni
00114 );
00115
00116 convertPatchPointField
00117 (
00118 tptf().name(),
00119 tptf().boundaryField()[patchi]
00120 .patchInternalField()(),
00121 regioni
00122 );
00123 }
00124 else
00125 {
00126 fvPatch p
00127 (
00128 ptf.patch().patch(),
00129 tf.mesh().boundary()
00130 );
00131
00132 convertPatchFaceField
00133 (
00134 tf.name(),
00135 fvPatchField<Type>(p, tf)
00136 .patchInternalField()(),
00137 regioni
00138 );
00139
00140 convertPatchPointField
00141 (
00142 tptf().name(),
00143 tptf().boundaryField()[patchi]
00144 .patchInternalField()(),
00145 regioni
00146 );
00147 }
00148 }
00149 }
00150 }
00151 }
00152 }
00153 }
00154 }
00155
00156
00157 template<class Type>
00158 void Foam::vtkFoam::convertPointFields
00159 (
00160 const fvMesh& mesh,
00161 const IOobjectList& objects,
00162 vtkDataArraySelection *fieldSelection
00163 )
00164 {
00165 IOobjectList fieldObjects
00166 (
00167 objects.lookupClass
00168 (
00169 GeometricField<Type, pointPatchField, pointMesh>::typeName
00170 )
00171 );
00172
00173 label nSelectedFields = fieldSelection->GetNumberOfArrays();
00174
00175 for (label i=0; i<nSelectedFields; i++)
00176 {
00177 if(fieldSelection->GetArraySetting(i))
00178 {
00179 word fieldName = fieldSelection->GetArrayName(i);
00180
00181 if (fieldObjects.found(fieldName))
00182 {
00183 pointMesh pMesh(mesh);
00184
00185 GeometricField<Type, pointPatchField, pointMesh> ptf
00186 (
00187 IOobject
00188 (
00189 fieldName,
00190 mesh.time().timeName(),
00191 mesh,
00192 IOobject::MUST_READ
00193 ),
00194 pMesh
00195 );
00196
00197 if (selectedRegions_[0])
00198 {
00199 convertPointField
00200 (
00201 ptf,
00202 GeometricField<Type, fvPatchField, volMesh>::null()
00203 );
00204 }
00205
00206 label regioni = 0;
00207 forAll (mesh.boundaryMesh(), patchi)
00208 {
00209 if (mesh.boundaryMesh()[patchi].size())
00210 {
00211 regioni++;
00212
00213 if (selectedRegions_[regioni])
00214 {
00215 convertPatchPointField
00216 (
00217 ptf.name(),
00218 ptf.boundaryField()[patchi]
00219 .patchInternalField()(),
00220 regioni
00221 );
00222 }
00223 }
00224 }
00225 }
00226 }
00227 }
00228 }
00229
00230
00231
00232
00233 #endif
00234
00235
Copyright © 2000-2009 OpenCFD Ltd