Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2009-08-13 15:52:57 +01:00
4 changed files with 61 additions and 41 deletions

View File

@ -97,7 +97,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::XX) sigma.component(symmTensor::XX)
); );
sigmaxx.write(); sigmaxx.write();
@ -110,7 +110,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::YY) sigma.component(symmTensor::YY)
); );
sigmayy.write(); sigmayy.write();
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::ZZ) sigma.component(symmTensor::ZZ)
); );
sigmazz.write(); sigmazz.write();
@ -136,7 +136,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::XY) sigma.component(symmTensor::XY)
); );
sigmaxy.write(); sigmaxy.write();
@ -149,7 +149,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::XZ) sigma.component(symmTensor::XZ)
); );
sigmaxz.write(); sigmaxz.write();
@ -162,7 +162,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
sigma.component(tensor::YZ) sigma.component(symmTensor::YZ)
); );
sigmayz.write(); sigmayz.write();
@ -190,7 +190,7 @@ int main(int argc, char *argv[])
mesh, mesh,
IOobject::NO_READ IOobject::NO_READ
), ),
0.0*sigma.component(tensor::YZ) 0.0*sigma.component(symmTensor::YZ)
); );
forAll(sigmaUn.boundaryField(), patchI) forAll(sigmaUn.boundaryField(), patchI)

View File

@ -45,38 +45,44 @@ char Foam::ISstream::nextValid()
// Return if stream is bad - ie, previous get() failed // Return if stream is bad - ie, previous get() failed
if (bad() || isspace(c)) if (bad() || isspace(c))
{ {
return 0; break;
} }
// Is this the start of a C/C++ comment? // Is this the start of a C/C++ comment?
if (c == '/') if (c == '/')
{ {
// If cannot get another character, return this one
if (!get(c)) if (!get(c))
{ {
// cannot get another character - return this one
return '/'; return '/';
} }
if (c == '/') if (c == '/')
{ {
// This is the start of a C++ style one-line comment // C++ style single-line comment - skip through past end-of-line
while (get(c) && c != '\n') while (get(c) && c != '\n')
{} {}
} }
else if (c == '*') else if (c == '*')
{ {
// This is the start of a C style comment // within a C-style comment
while (true) while (true)
{ {
// search for end of C-style comment - '*/'
if (get(c) && c == '*') if (get(c) && c == '*')
{ {
if (get(c) && c == '/') if (get(c))
{ {
break; if (c == '/')
} {
else // matched '*/'
{ break;
putback(c); }
else if (c == '*')
{
// check again
putback(c);
}
} }
} }
@ -86,17 +92,21 @@ char Foam::ISstream::nextValid()
} }
} }
} }
else // A lone '/' so return it. else
{ {
// The '/' did not start a C/C++ comment - return it
putback(c); putback(c);
return '/'; return '/';
} }
} }
else // c is a valid character so return it else
{ {
// a valid character - return it
return c; return c;
} }
} }
return 0;
} }
@ -277,8 +287,8 @@ Foam::Istream& Foam::ISstream::read(token& t)
// } // }
} }
// nothing converted (bad format), or trailing junk // not everything converted: bad format or trailing junk
if (endptr == buf || *endptr != '\0') if (*endptr)
{ {
t.setBad(); t.setBad();
} }
@ -289,7 +299,7 @@ Foam::Istream& Foam::ISstream::read(token& t)
} }
// Should be a word (which can be a single character) // Should be a word (which can also be a single character)
default: default:
{ {
putback(c); putback(c);

View File

@ -117,6 +117,10 @@ bool Foam::argList::regroupArgv(int& argc, char**& argv)
// get rootPath_ / globalCase_ from one of the following forms // get rootPath_ / globalCase_ from one of the following forms
// * [-case dir] // * [-case dir]
// * cwd // * cwd
//
// Also export FOAM_CASE and FOAM_CASENAME environment variables
// so they can be used immediately (eg, in decomposeParDict)
//
void Foam::argList::getRootCase() void Foam::argList::getRootCase()
{ {
fileName casePath; fileName casePath;
@ -151,6 +155,26 @@ void Foam::argList::getRootCase()
rootPath_ = casePath.path(); rootPath_ = casePath.path();
globalCase_ = casePath.name(); globalCase_ = casePath.name();
case_ = globalCase_; case_ = globalCase_;
// Set the case and case-name as an environment variable
if (rootPath_[0] == '/')
{
// absolute path - use as-is
setEnv("FOAM_CASE", rootPath_/globalCase_, true);
setEnv("FOAM_CASENAME", globalCase_, true);
}
else
{
// qualify relative path
fileName casePath = cwd()/rootPath_/globalCase_;
casePath.clean();
setEnv("FOAM_CASE", casePath, true);
setEnv("FOAM_CASENAME", casePath.name(), true);
}
} }
@ -531,24 +555,6 @@ Foam::argList::argList
} }
jobInfo.write(); jobInfo.write();
// Set the case and case-name as an environment variable
if (rootPath_[0] == '/')
{
// absolute path - use as-is
setEnv("FOAM_CASE", rootPath_/globalCase_, true);
setEnv("FOAM_CASENAME", globalCase_, true);
}
else
{
// qualify relative path
fileName casePath = cwd()/rootPath_/globalCase_;
casePath.clean();
setEnv("FOAM_CASE", casePath, true);
setEnv("FOAM_CASENAME", casePath.name(), true);
}
// Switch on signal trapping. We have to wait until after Pstream::init // Switch on signal trapping. We have to wait until after Pstream::init
// since this sets up its own ones. // since this sets up its own ones.
sigFpe_.set(bannerEnabled); sigFpe_.set(bannerEnabled);

View File

@ -81,7 +81,10 @@ Foam::porousZone::porousZone
{ {
Info<< "Creating porous zone: " << name_ << endl; Info<< "Creating porous zone: " << name_ << endl;
if (cellZoneID_ == -1 && !Pstream::parRun()) bool foundZone = (cellZoneID_ != -1);
reduce(foundZone, orOp<bool>());
if (!foundZone && Pstream::master())
{ {
FatalErrorIn FatalErrorIn
( (
@ -91,6 +94,7 @@ Foam::porousZone::porousZone
<< exit(FatalError); << exit(FatalError);
} }
// porosity // porosity
if (dict_.readIfPresent("porosity", porosity_)) if (dict_.readIfPresent("porosity", porosity_))
{ {