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 #include "pointFieldDecomposer.H"
00027 #include <OpenFOAM/processorPointPatchFields.H>
00028 #include <OpenFOAM/globalPointPatchFields.H>
00029 
00030 
00031 
00032 namespace Foam
00033 {
00034 
00035 
00036 
00037 template<class Type>
00038 tmp<GeometricField<Type, pointPatchField, pointMesh> >
00039 pointFieldDecomposer::decomposeField
00040 (
00041     const GeometricField<Type, pointPatchField, pointMesh>& field
00042 ) const
00043 {
00044     
00045     Field<Type> internalField(field.internalField(), pointAddressing_);
00046 
00047     
00048     
00049     PtrList<pointPatchField<Type> > patchFields
00050     (
00051         boundaryAddressing_.size() + 1
00052     );
00053 
00054     
00055     forAll (boundaryAddressing_, patchi)
00056     {
00057         if (patchFieldDecomposerPtrs_[patchi])
00058         {
00059             patchFields.set
00060             (
00061                 patchi,
00062                 pointPatchField<Type>::New
00063                 (
00064                     field.boundaryField()[boundaryAddressing_[patchi]],
00065                     procMesh_.boundary()[patchi],
00066                     DimensionedField<Type, pointMesh>::null(),
00067                     *patchFieldDecomposerPtrs_[patchi]
00068                 )
00069             );
00070         }
00071         else
00072         {
00073             patchFields.set
00074             (
00075                 patchi,
00076                 new processorPointPatchField<Type>
00077                 (
00078                     procMesh_.boundary()[patchi],
00079                     DimensionedField<Type, pointMesh>::null()
00080                 )
00081             );
00082         }
00083     }
00084 
00085     
00086     patchFields.set
00087     (
00088         boundaryAddressing_.size(),
00089         new globalPointPatchField<Type>
00090         (
00091             procMesh_.boundary().globalPatch(),
00092             DimensionedField<Type, pointMesh>::null()
00093         )
00094     );
00095 
00096     
00097     return tmp<GeometricField<Type, pointPatchField, pointMesh> >
00098     (
00099         new GeometricField<Type, pointPatchField, pointMesh>
00100         (
00101             IOobject
00102             (
00103                 field.name(),
00104                 procMesh_().time().timeName(),
00105                 procMesh_(),
00106                 IOobject::NO_READ,
00107                 IOobject::NO_WRITE
00108             ),
00109             procMesh_,
00110             field.dimensions(),
00111             internalField,
00112             patchFields
00113         )
00114     );
00115 }
00116 
00117 
00118 template<class GeoField>
00119 void pointFieldDecomposer::decomposeFields
00120 (
00121     const PtrList<GeoField>& fields
00122 ) const
00123 {
00124     forAll (fields, fieldI)
00125     {
00126         decomposeField(fields[fieldI])().write();
00127     }
00128 }
00129 
00130 
00131 
00132 
00133 } 
00134 
00135