37 int main(
int argc,
char *argv[])
39 argList::noParallel();
40 argList::validArgs.append(
"SMAP file");
42 argList
args(argc, argv);
52 dictionary fieldNameDict;
55 fieldNameDict.add(word(fieldNames[i]), word(fieldNames[i]));
59 if (fieldNameDict.found(
"U")) nameMap.add(
"SU", word(
"U"));
60 if (fieldNameDict.found(
"p")) nameMap.add(
"P", word(
"p"));
61 if (fieldNameDict.found(
"T")) nameMap.add(
"T", word(
"T"));
62 if (fieldNameDict.found(
"rho")) nameMap.add(
"DENS", word(
"rho"));
63 if (fieldNameDict.found(
"k")) nameMap.add(
"TE", word(
"k"));
64 if (fieldNameDict.found(
"epsilon")) nameMap.add(
"ED", word(
"epsilon"));
65 if (fieldNameDict.found(
"nuEff")) nameMap.add(
"VIS", word(
"nuEff"));
69 IFstream smapFile(
args[1]);
74 <<
"Cannot open SMAP file " << smapFile.name()
78 while (!smapFile.eof())
82 token fieldName(smapFile);
91 fieldName.type() != token::WORD
92 && fieldName.wordToken() !=
"CELL" 96 <<
"Expected first CELL, found " 102 smapFile >> fieldName;
103 while (fieldName.type() == token::WORD)
105 starFieldNames[nCols++] = fieldName.wordToken();
106 smapFile >> fieldName;
109 List<volScalarField*> sFields
112 reinterpret_cast<volScalarField*>(0)
115 List<volVectorField*> vFields
118 reinterpret_cast<volVectorField*>(0)
124 if (nameMap.found(starFieldNames[i]))
126 if (starFieldNames[i] ==
"SU")
133 nameMap.lookup(starFieldNames[i]),
137 IOobject::AUTO_WRITE,
152 nameMap.lookup(starFieldNames[i]),
156 IOobject::AUTO_WRITE,
186 smapFile >> (*sFields[i])[celli];
191 smapFile >> (*vFields[i])[celli].
x();
192 smapFile >> (*vFields[i])[celli].
y();
193 smapFile >> (*vFields[i])[celli].z();
204 for (
label i=0; i<nCols; i++)
208 sFields[i]->correctBoundaryConditions();
211 sFields[i] =
nullptr;
215 vFields[i]->correctBoundaryConditions();
218 vFields[i] =
nullptr;
228 <<
"Expected first SMAP dummy entry to be cell 0, found " 233 for (
label i=0; i<nCols; i++)
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
GeometricField< vector, fvPatchField, volMesh > volVectorField
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true)
Read a directory and return the entries as a string list.
List< word > wordList
A List of words.
bool check(bool checkArgs=true, bool checkOpts=true) const
Check argument list.
Foam::argList args(argc, argv)
List< fileName > fileNameList
A List of fileNames.