pointFieldReconstructorReconstructFields.C
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 #include "pointFieldReconstructor.H"
00028
00029
00030
00031 template<class Type>
00032 Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
00033 Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
00034 {
00035
00036 PtrList<GeometricField<Type, pointPatchField, pointMesh> > procFields
00037 (
00038 procMeshes_.size()
00039 );
00040
00041 forAll (procMeshes_, proci)
00042 {
00043 procFields.set
00044 (
00045 proci,
00046 new GeometricField<Type, pointPatchField, pointMesh>
00047 (
00048 IOobject
00049 (
00050 fieldIoObject.name(),
00051 procMeshes_[proci]().time().timeName(),
00052 procMeshes_[proci](),
00053 IOobject::MUST_READ,
00054 IOobject::NO_WRITE
00055 ),
00056 procMeshes_[proci]
00057 )
00058 );
00059 }
00060
00061
00062
00063 Field<Type> internalField(mesh_.size());
00064
00065
00066 PtrList<pointPatchField<Type> > patchFields(mesh_.boundary().size());
00067
00068
00069 forAll (procMeshes_, proci)
00070 {
00071 const GeometricField<Type, pointPatchField, pointMesh>&
00072 procField = procFields[proci];
00073
00074
00075 const labelList& procToGlobalAddr = pointProcAddressing_[proci];
00076
00077
00078 internalField.rmap
00079 (
00080 procField.internalField(),
00081 procToGlobalAddr
00082 );
00083
00084
00085 forAll(boundaryProcAddressing_[proci], patchi)
00086 {
00087
00088 const label curBPatch = boundaryProcAddressing_[proci][patchi];
00089
00090
00091 if (curBPatch >= 0)
00092 {
00093 if (!patchFields(curBPatch))
00094 {
00095 patchFields.set(
00096 curBPatch,
00097 pointPatchField<Type>::New
00098 (
00099 procField.boundaryField()[patchi],
00100 mesh_.boundary()[curBPatch],
00101 DimensionedField<Type, pointMesh>::null(),
00102 pointPatchFieldReconstructor
00103 (
00104 mesh_.boundary()[curBPatch].size()
00105 )
00106 )
00107 );
00108 }
00109
00110 patchFields[curBPatch].rmap
00111 (
00112 procField.boundaryField()[patchi],
00113 patchPointAddressing_[proci][patchi]
00114 );
00115 }
00116 }
00117 }
00118
00119
00120
00121 return tmp<GeometricField<Type, pointPatchField, pointMesh> >
00122 (
00123 new GeometricField<Type, pointPatchField, pointMesh>
00124 (
00125 IOobject
00126 (
00127 fieldIoObject.name(),
00128 mesh_().time().timeName(),
00129 mesh_(),
00130 IOobject::NO_READ,
00131 IOobject::NO_WRITE
00132 ),
00133 mesh_,
00134 procFields[0].dimensions(),
00135 internalField,
00136 patchFields
00137 )
00138 );
00139 }
00140
00141
00142
00143 template<class Type>
00144 void Foam::pointFieldReconstructor::reconstructFields
00145 (
00146 const IOobjectList& objects
00147 )
00148 {
00149 word fieldClassName
00150 (
00151 GeometricField<Type, pointPatchField, pointMesh>::typeName
00152 );
00153
00154 IOobjectList fields = objects.lookupClass(fieldClassName);
00155
00156 if (fields.size())
00157 {
00158 Info<< " Reconstructing " << fieldClassName << "s\n" << endl;
00159
00160 for
00161 (
00162 IOobjectList::iterator fieldIter = fields.begin();
00163 fieldIter != fields.end();
00164 ++fieldIter
00165 )
00166 {
00167 Info<< " " << fieldIter()->name() << endl;
00168
00169 reconstructField<Type>(*fieldIter())().write();
00170 }
00171
00172 Info<< endl;
00173 }
00174 }
00175
00176
00177
Copyright © 2000-2009 OpenCFD Ltd