diff --git a/src/Allwmake b/src/Allwmake index 2c532a41aa..341ee2ed6f 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -2,7 +2,8 @@ cd ${0%/*} || exit 1 # run from this directory set -x -( cd OpenFOAM && wmakeLnInclude . ) +wmakeLnInclude -f OpenFOAM +wmakeLnInclude -f OSspecific/$WM_OS ( cd Pstream && ./Allwmake ) wmake libo OSspecific/$WM_OS diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C index f425accf72..3e8fc3fe0f 100644 --- a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C +++ b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C @@ -101,7 +101,7 @@ Foam::LUscalarMatrix::LUscalarMatrix nCells += lduMatrices[i].size(); } - scalarSquareMatrix m(nCells, 0.0); + scalarSquareMatrix m(nCells, nCells, 0.0); transfer(m); convert(lduMatrices); } @@ -109,7 +109,7 @@ Foam::LUscalarMatrix::LUscalarMatrix else { label nCells = ldum.lduAddr().size(); - scalarSquareMatrix m(nCells, 0.0); + scalarSquareMatrix m(nCells, nCells, 0.0); transfer(m); convert(ldum, interfaceCoeffs, interfaces); } diff --git a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.H b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.H index 6239781d85..27160dc239 100644 --- a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.H +++ b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrix.H @@ -69,9 +69,10 @@ public: // It checks that m == n. inline SquareMatrix(const label m, const label n); - //- Construct with given number of rows/columns + //- Construct with given number of rows and rows // and value for all elements. - inline SquareMatrix(const label n, const Type&); + // It checks that m == n. + inline SquareMatrix(const label m, const label n, const Type&); //- Construct from Istream. inline SquareMatrix(Istream&); diff --git a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H index a7371a6a2e..d3ee1cd6bf 100644 --- a/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H +++ b/src/OpenFOAM/matrices/SquareMatrix/SquareMatrixI.H @@ -53,10 +53,24 @@ inline Foam::SquareMatrix::SquareMatrix(const label m, const label n) } template -inline Foam::SquareMatrix::SquareMatrix(const label n, const Type& t) +inline Foam::SquareMatrix::SquareMatrix +( + const label m, + const label n, + const Type& t +) : - Matrix, Type>(n, t) -{} + Matrix, Type>(m, n, t) +{ + if (m != n) + { + FatalErrorIn + ( + "SquareMatrix::SquareMatrix" + "(const label m, const label n, const Type&)" + ) << "m != n for constructing a square matrix" << exit(FatalError); + } +} template inline Foam::SquareMatrix::SquareMatrix(Istream& is) diff --git a/src/triSurface/triSurface/interfaces/NAS/readNAS.C b/src/triSurface/triSurface/interfaces/NAS/readNAS.C index 2ec15c6706..1440c2d15d 100644 --- a/src/triSurface/triSurface/interfaces/NAS/readNAS.C +++ b/src/triSurface/triSurface/interfaces/NAS/readNAS.C @@ -23,10 +23,16 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Nastran surface reader. Does Ansa $ANSA_NAME extension to get name - of patch. Handles Ansa coordinates like: + Nastran surface reader. + - Uses the Ansa "$ANSA_NAME" or the Hypermesh "$HMNAME COMP" extensions + to obtain patch names. + - Handles Nastran short and long formats, but not free format. + - Properly handles the Nastran compact floating point notation: \n + @verbatim GRID 28 10.20269-.030265-2.358-8 + @endverbatim + \*---------------------------------------------------------------------------*/ @@ -49,13 +55,13 @@ static scalar parseNASCoord(const string& s) if (expSign != string::npos && expSign > 0 && !isspace(s[expSign-1])) { scalar mantissa = readScalar(IStringStream(s.substr(0, expSign))()); - scalar exp = readScalar(IStringStream(s.substr(expSign+1))()); + scalar exponent = readScalar(IStringStream(s.substr(expSign+1))()); if (s[expSign] == '-') { - exp = -exp; + exponent = -exponent; } - return mantissa*pow(10, exp); + return mantissa*pow(10, exponent); } else { @@ -64,14 +70,14 @@ static scalar parseNASCoord(const string& s) } -bool triSurface::readNAS(const fileName& OBJfileName) +bool triSurface::readNAS(const fileName& fName) { - IFstream OBJfile(OBJfileName); + IFstream is(fName); - if (!OBJfile.good()) + if (!is.good()) { FatalErrorIn("triSurface::readNAS(const fileName&)") - << "Cannot read file " << OBJfileName + << "Cannot read file " << fName << exit(FatalError); } @@ -90,17 +96,17 @@ bool triSurface::readNAS(const fileName& OBJfileName) // Ansa tags. Denoted by $ANSA_NAME. These will appear just before the // first use of a type. We read them and store the pshell types which // are used to name the patches. - label ansaID = -1; + label ansaId = -1; word ansaType; string ansaName; - // Done warnings per unrecognized command + // A single warning per unrecognized command HashSet unhandledCmd; - while (OBJfile.good()) + while (is.good()) { string line; - OBJfile.getLine(line); + is.getLine(line); // Ansa extension if (line.substr(0, 10) == "$ANSA_NAME") @@ -116,14 +122,14 @@ bool triSurface::readNAS(const fileName& OBJfileName) && sem2 != string::npos ) { - ansaID = readLabel + ansaId = readLabel ( IStringStream(line.substr(sem0+1, sem1-sem0-1))() ); ansaType = line.substr(sem1+1, sem2-sem1-1); string nameString; - OBJfile.getLine(ansaName); + is.getLine(ansaName); if (ansaName[ansaName.size()-1] == '\r') { ansaName = ansaName.substr(1, ansaName.size()-2); @@ -132,13 +138,37 @@ bool triSurface::readNAS(const fileName& OBJfileName) { ansaName = ansaName.substr(1, ansaName.size()-1); } - //Pout<< "ANSA tag for NastranID:" << ansaID - // << " of type " << ansaType - // << " name " << ansaName << endl; + + // Info<< "ANSA tag for NastranID:" << ansaId + // << " of type " << ansaType + // << " name " << ansaName << endl; } } + // Hypermesh extension + // $HMNAME COMP 1"partName" + if + ( + line.substr(0, 12) == "$HMNAME COMP" + && line.find ('"') != string::npos + ) + { + label groupId = readLabel + ( + IStringStream(line.substr(16, 16))() + ); + + IStringStream lineStream(line.substr(32)); + + string rawName; + lineStream >> rawName; + + groupToName.insert(groupId, string::validate(rawName)); + Info<< "group " << groupId << " => " << rawName << endl; + } + + if (line.size() == 0 || line[0] == '$') { // Skip empty or comment @@ -153,7 +183,7 @@ bool triSurface::readNAS(const fileName& OBJfileName) while (true) { string buf; - OBJfile.getLine(buf); + is.getLine(buf); if (buf.size() > 72 && buf[72]=='+') { @@ -174,26 +204,21 @@ bool triSurface::readNAS(const fileName& OBJfileName) if (cmd == "CTRIA3") { - //label index, group, a, b, c; - //lineStream >> index >> group >> a >> b >> c; - label group = readLabel(IStringStream(line.substr(16,8))()); + label groupId = readLabel(IStringStream(line.substr(16,8))()); label a = readLabel(IStringStream(line.substr(24,8))()); label b = readLabel(IStringStream(line.substr(32,8))()); label c = readLabel(IStringStream(line.substr(40,8))()); // Convert group into patch - Map