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