reconstructLagrangianFields.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 "IOField.H"
00028 #include "Time.H"
00029
00030
00031
00032 template<class Type>
00033 Foam::tmp<Foam::IOField<Type> > Foam::reconstructLagrangianField
00034 (
00035 const word& cloudName,
00036 const polyMesh& mesh,
00037 const PtrList<fvMesh>& meshes,
00038 const word& fieldName
00039 )
00040 {
00041
00042 tmp<IOField<Type> > tfield
00043 (
00044 new IOField<Type>
00045 (
00046 IOobject
00047 (
00048 fieldName,
00049 mesh.time().timeName(),
00050 cloud::prefix/cloudName,
00051 mesh,
00052 IOobject::NO_READ,
00053 IOobject::NO_WRITE
00054 ),
00055 Field<Type>(0)
00056 )
00057 );
00058 Field<Type>& field = tfield();
00059
00060 forAll(meshes, i)
00061 {
00062
00063 IOobject localIOobject
00064 (
00065 fieldName,
00066 meshes[i].time().timeName(),
00067 cloud::prefix/cloudName,
00068 meshes[i],
00069 IOobject::MUST_READ,
00070 IOobject::NO_WRITE
00071 );
00072
00073 if (localIOobject.headerOk())
00074 {
00075 IOField<Type> fieldi(localIOobject);
00076
00077 label offset = field.size();
00078 field.setSize(offset + fieldi.size());
00079
00080 forAll(fieldi, j)
00081 {
00082 field[offset + j] = fieldi[j];
00083 }
00084 }
00085 }
00086
00087 return tfield;
00088 }
00089
00090
00091 template<class Type>
00092 void Foam::reconstructLagrangianFields
00093 (
00094 const word& cloudName,
00095 const polyMesh& mesh,
00096 const PtrList<fvMesh>& meshes,
00097 const IOobjectList& objects
00098 )
00099 {
00100 word fieldClassName(IOField<Type>::typeName);
00101
00102 IOobjectList fields = objects.lookupClass(fieldClassName);
00103
00104 if (fields.size())
00105 {
00106 Info<< " Reconstructing lagrangian "
00107 << fieldClassName << "s\n" << endl;
00108
00109 forAllIter(IOobjectList, fields, fieldIter)
00110 {
00111 Info<< " " << fieldIter()->name() << endl;
00112 reconstructLagrangianField<Type>
00113 (
00114 cloudName,
00115 mesh,
00116 meshes,
00117 fieldIter()->name()
00118 )().write();
00119 }
00120
00121 Info<< endl;
00122 }
00123 }
00124
00125
00126
Copyright © 2000-2009 OpenCFD Ltd