1 //======================================================================
3 //======================================================================
4 int USERD_set_filenames
13 Info<< "Entering: USERD_set_filenames" << endl << flush;
18 label lRoot = strlen(the_path);
19 label lCase = strlen(filename_1);
25 lRoot = strlen(the_path);
26 lCase = strlen(filename_1);
28 // remove the last '/' from rootDir
29 if (the_path[lRoot-1] == '/')
31 the_path[lRoot-1] = (char)NULL;
41 // the path is pre-pended to filename_1
42 // 1 is the 'Geometry' : 2 the 'Result' which is null here
43 // since two_field is FALSE
44 for (label i=0; i<lCase-lRoot;i++)
46 tmp[i] = filename_1[i+1+lRoot];
50 if (!isDir(rootDir/caseDir))
52 Info<< rootDir/caseDir << " is not a valid directory."
57 // construct the global pointers to the database and mesh
64 Time::controlDictName,
69 Time& runTime = *runTimePtr;
75 fvMesh::defaultRegion,
81 // set the available number of time-steps
82 timeDirs = Foam::Time::findTimes(rootDir/caseDir);
84 Num_time_steps = timeDirs.size() - 1;
86 nPatches = meshPtr->boundaryMesh().size();
88 // set the number of fields and store their names
89 // a valid field must exist for all time-steps
90 runTime.setTime(timeDirs.last(), timeDirs.size()-1);
91 IOobjectList objects(*meshPtr, runTime.timeName());
93 fieldNames = objects.names();
95 // because of the spray being a 'field' ...
96 // get the availabe number of variables and
97 // check for type (scalar/vector/tensor)
100 wordList scalars = objects.names(scalarName);
102 forAll(fieldNames, n)
104 bool isitScalar = false;
107 if (fieldNames[n] == scalars[i])
110 var2field[nVar++] = n;
113 isScalar[n] = isitScalar;
116 wordList vectors = objects.names(vectorName);
118 forAll(fieldNames, n)
120 bool isitVector = false;
123 if (fieldNames[n] == vectors[i])
126 var2field[nVar++] = n;
129 isVector[n] = isitVector;
132 wordList tensors = objects.names(tensorName);
134 forAll(fieldNames, n)
136 bool isitTensor = false;
139 if (fieldNames[n] == tensors[i])
142 var2field[nVar++] = n;
145 isTensor[n] = isitTensor;
148 bool lagrangianNamesFound = false;
150 while (!lagrangianNamesFound && n < Num_time_steps)
152 runTime.setTime(timeDirs[n+1], n+1);
154 Cloud<passiveParticle> lagrangian(*meshPtr);
157 if (lagrangian.size())
159 lagrangianNamesFound = true;
174 if (sprayHeader.headerOk())
176 Info<< "[Found lagrangian]" << endl;
180 sprayPtr = new Cloud<passiveParticle>(*meshPtr);
182 IOobjectList objects(*meshPtr, runTime.timeName(), cloud::prefix);
184 lagrangianScalarNames =
185 (const wordList&)objects.names(sprayScalarFieldName);
186 lagrangianVectorNames =
187 (const wordList&)objects.names(sprayVectorFieldName);
189 isSpray[fieldNames.size()] = true;
191 nSprayVariables += lagrangianScalarNames.size();
192 nSprayVariables += lagrangianVectorNames.size();
194 Num_unstructured_parts++;
197 Current_time_step = Num_time_steps;
198 runTime.setTime(timeDirs[Current_time_step], Current_time_step);
200 Num_variables = nVar + nSprayVariables;
202 Num_unstructured_parts + Num_structured_parts + nPatches;
205 Info<< "Leaving: USERD_set_filenames" << endl << flush;