Add flex version selection of the yywrap() function to support
the new and more correct version 2.5.34.
This commit is contained in:
parent
ff6dd11bc2
commit
8dc018bb53
@ -70,7 +70,11 @@ PtrList<SLList<label> > slPatchCellFaces;
|
||||
// Dummy yywrap to keep yylex happy at compile time.
|
||||
// It is called by yylex but is not used as the mechanism to change file.
|
||||
// See <<EOF>>
|
||||
#if YY_FLEX_SUBMINOR_VERSION < 34
|
||||
extern "C" int yywrap()
|
||||
#else
|
||||
int yyFlexLexer::yywrap()
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -393,7 +397,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Warning: tet face order has changed between version 1.9.6 and 2.0
|
||||
//
|
||||
//
|
||||
label faceIndex[7][6] =
|
||||
{
|
||||
{-1, -1, -1, -1, -1, -1}, // 0
|
||||
|
@ -116,7 +116,11 @@ void uniquify(word& name, HashSet<word>& patchNames)
|
||||
// Dummy yywrap to keep yylex happy at compile time.
|
||||
// It is called by yylex but is not used as the mechanism to change file.
|
||||
// See <<EOF>>
|
||||
#if YY_FLEX_SUBMINOR_VERSION < 34
|
||||
extern "C" int yywrap()
|
||||
#else
|
||||
int yyFlexLexer::yywrap()
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ SLList<label> cellGroupEndIndex;
|
||||
SLList<label> cellGroupType;
|
||||
|
||||
// number of zones adjusted at run-time if necessary
|
||||
label maxZoneID = 100;
|
||||
label maxZoneID = 100;
|
||||
label zoneIDBuffer = 10;
|
||||
|
||||
wordList patchTypeIDs(maxZoneID);
|
||||
@ -102,7 +102,11 @@ wordList patchNameIDs(maxZoneID);
|
||||
// Dummy yywrap to keep yylex happy at compile time.
|
||||
// It is called by yylex but is not used as the mechanism to change file.
|
||||
// See <<EOF>>
|
||||
#if YY_FLEX_SUBMINOR_VERSION < 34
|
||||
extern "C" int yywrap()
|
||||
#else
|
||||
int yyFlexLexer::yywrap()
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -343,7 +347,7 @@ endOfSection {space}")"{space}
|
||||
// In FOAM, indices start from zero - adjust
|
||||
pointI = pointGroupStartIndex.last() - 1;
|
||||
|
||||
// reset number of components to default
|
||||
// reset number of components to default
|
||||
pointGroupNumberOfComponents = 3;
|
||||
|
||||
// read number of components in the vector
|
||||
@ -375,7 +379,7 @@ endOfSection {space}")"{space}
|
||||
|
||||
IStringStream vertexXyzStream(YYText());
|
||||
|
||||
// Note: coordinates must be read one at the time.
|
||||
// Note: coordinates must be read one at the time.
|
||||
scalar x = readScalar(vertexXyzStream);
|
||||
scalar y = readScalar(vertexXyzStream);
|
||||
|
||||
@ -387,7 +391,7 @@ endOfSection {space}")"{space}
|
||||
|
||||
IStringStream vertexXyzStream(YYText());
|
||||
|
||||
// Note: coordinates must be read one at the time.
|
||||
// Note: coordinates must be read one at the time.
|
||||
scalar x = readScalar(vertexXyzStream);
|
||||
scalar y = readScalar(vertexXyzStream);
|
||||
scalar z = readScalar(vertexXyzStream);
|
||||
@ -587,7 +591,7 @@ endOfSection {space}")"{space}
|
||||
|
||||
|
||||
// Note. Potentially skip cell set if type is zero.
|
||||
// This entry does not exist in Tgrid files.
|
||||
// This entry does not exist in Tgrid files.
|
||||
if (dimensionOfGrid == 2)
|
||||
{
|
||||
// Tgrid creating triangles
|
||||
@ -702,7 +706,7 @@ endOfSection {space}")"{space}
|
||||
|
||||
IStringStream zoneDataStream(YYText());
|
||||
|
||||
// cell zone-ID not in hexadecimal!!! Inconsistency
|
||||
// cell zone-ID not in hexadecimal!!! Inconsistency
|
||||
label zoneID(readLabel(zoneDataStream));
|
||||
|
||||
if (zoneID > maxZoneID - 1)
|
||||
@ -727,7 +731,7 @@ endOfSection {space}")"{space}
|
||||
// Fluent manual inconsistency, version 6.1.22
|
||||
IStringStream zoneDataStream(YYText());
|
||||
|
||||
// cell zone-ID not in hexadecimal!!! Inconsistency
|
||||
// cell zone-ID not in hexadecimal!!! Inconsistency
|
||||
label zoneID(readLabel(zoneDataStream));
|
||||
|
||||
if (zoneID > maxZoneID - 1)
|
||||
@ -879,7 +883,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
scaleFactor = atof(args.options()["scale"].c_str());
|
||||
}
|
||||
|
||||
|
||||
bool writeSets = args.options().found("writeSets");
|
||||
bool writeZones = args.options().found("writeZones");
|
||||
|
||||
@ -901,7 +905,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "\n\nFINISHED LEXING\n\n\n";
|
||||
// Lookup table giving number of vertices given a fluent cell type ID
|
||||
// Currently not used.
|
||||
// Currently not used.
|
||||
// label fluentModelNVertices[7] = {-1, 3, 4, 4, 8, 5, 6};
|
||||
|
||||
// Lookup table giving number of vertices given a fluent cell type ID
|
||||
@ -973,7 +977,7 @@ int main(int argc, char *argv[])
|
||||
// Note: In order for the owner-neighbour rules to be right, the
|
||||
// points given by Fluent need to represent the FRONT plane of the
|
||||
// geometry. Therefore, the extrusion will be in -z direction
|
||||
//
|
||||
//
|
||||
forAll (oldPoints, pointI)
|
||||
{
|
||||
points[nNewPoints] = oldPoints[pointI];
|
||||
@ -1131,20 +1135,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
//make patchless mesh before analysing boundaries
|
||||
|
||||
|
||||
faceListList patches(0);
|
||||
wordList patchNames(0);
|
||||
wordList patchTypes(0);
|
||||
word defaultFacesName = "defaultFaces";
|
||||
word defaultFacesType = emptyPolyPatch::typeName;
|
||||
wordList patchPhysicalTypes(0);
|
||||
|
||||
|
||||
// Scale the points
|
||||
|
||||
|
||||
points *= scaleFactor;
|
||||
|
||||
|
||||
Info<< "Building patch-less mesh..." << flush;
|
||||
|
||||
|
||||
polyMesh pShapeMesh
|
||||
(
|
||||
IOobject
|
||||
@ -1167,13 +1171,13 @@ int main(int argc, char *argv[])
|
||||
//and zones wont be written
|
||||
//checkmesh done after patch addition as well
|
||||
Info<< "done." << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
Info<< endl << "Building boundary and internal patches." << endl;
|
||||
//adding patches after mesh construction allows topological checks
|
||||
//on whether a patch is internal or external, something fluent
|
||||
//on whether a patch is internal or external, something fluent
|
||||
//doesnt seem to mind
|
||||
|
||||
|
||||
// Make boundary patches
|
||||
|
||||
SLList<label>::iterator faceGroupZoneIDIter = faceGroupZoneID.begin();
|
||||
@ -1183,7 +1187,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Note. Not all groups of faces will be boundary patches.
|
||||
// Take care on construction
|
||||
|
||||
|
||||
//2D needs extra space for frontAndBack faces
|
||||
if (dimensionOfGrid == 2)
|
||||
{
|
||||
@ -1221,7 +1225,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Creating patch " << nPatches
|
||||
<< " for zone: " << faceGroupZoneIDIter()
|
||||
<< " start: " << faceGroupStartIndexIter()
|
||||
<< " start: " << faceGroupStartIndexIter()
|
||||
<< " end: " << faceGroupEndIndexIter()
|
||||
<< " type: " << curPatchType << " name: " << curPatchName << endl;
|
||||
|
||||
@ -1251,7 +1255,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
//inlets and outlets
|
||||
if
|
||||
if
|
||||
(
|
||||
curPatchType == "pressure"
|
||||
|| curPatchType == "pressure-inlet"
|
||||
@ -1317,7 +1321,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Patch " << faceGroupZoneIDIter()
|
||||
<< ": Faces are defined but "
|
||||
<< "not created as a zone." << endl
|
||||
<< "Null specification is only valid for internal faces."
|
||||
<< "Null specification is only valid for internal faces."
|
||||
<< endl;
|
||||
|
||||
patches[nPatches] = patchFaces;
|
||||
@ -1346,14 +1350,14 @@ int main(int argc, char *argv[])
|
||||
nPatches++;
|
||||
}
|
||||
|
||||
//Now have all patch information,
|
||||
//Now have all patch information,
|
||||
//check whether each patch is internal or external
|
||||
//and add boundaries to mesh
|
||||
//also write face sets of all patches
|
||||
patches.setSize(nPatches);
|
||||
patchTypes.setSize(nPatches);
|
||||
patchNames.setSize(nPatches);
|
||||
|
||||
|
||||
|
||||
//old polyBoundary
|
||||
const polyBoundaryMesh& oPatches = pShapeMesh.boundaryMesh();
|
||||
@ -1401,12 +1405,12 @@ int main(int argc, char *argv[])
|
||||
//if a face is defined as internal but is actually external
|
||||
//it will be put in a default wall boundary
|
||||
//internal boundaries are simply ignored
|
||||
|
||||
|
||||
if(patchTypes[patchI] != "internal" && !pShapeMesh.isInternalFace(meshFaces[0]))
|
||||
{
|
||||
//first face is external and has valid non-internal type
|
||||
|
||||
//check all faces for externalness just to be sure
|
||||
//check all faces for externalness just to be sure
|
||||
//and mark patch number to global list
|
||||
forAll(meshFaces, i)
|
||||
{
|
||||
@ -1424,7 +1428,7 @@ int main(int argc, char *argv[])
|
||||
if(facePatchID[faceI - pShapeMesh.nInternalFaces()]!= -1)
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Face " << faceI << " on new patch "
|
||||
<< "Face " << faceI << " on new patch "
|
||||
<< patchNames[patchI]
|
||||
<< " has already been marked for repatching to"
|
||||
<< " patch "
|
||||
@ -1435,8 +1439,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
//add to boundary patch
|
||||
|
||||
Info<< "Adding new patch " << patchNames[patchI]
|
||||
|
||||
Info<< "Adding new patch " << patchNames[patchI]
|
||||
<< " of type " << patchTypes[patchI]
|
||||
<< " as patch " << nBoundaries << endl;
|
||||
|
||||
@ -1458,15 +1462,15 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Patch " << patchNames[patchI]
|
||||
Info<< "Patch " << patchNames[patchI]
|
||||
<< " is internal to the mesh "
|
||||
<< " and is not being added to the boundary."
|
||||
<< endl;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Check for any remaining boundary faces
|
||||
|
||||
// Check for any remaining boundary faces
|
||||
// and add them to a default wall patch
|
||||
// this routine should generally not be invoked
|
||||
{
|
||||
@ -1480,16 +1484,16 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
defaultBoundaryFaces.shrink();
|
||||
|
||||
|
||||
if(defaultBoundaryFaces.size() != 0)
|
||||
{
|
||||
Warning << " fluent mesh has " << defaultBoundaryFaces.size()
|
||||
<< " undefined boundary faces." << endl
|
||||
<< " Adding undefined faces to new patch `default_wall`"
|
||||
<< endl;
|
||||
|
||||
|
||||
// Add patch to new patch list
|
||||
|
||||
|
||||
newPatches.append
|
||||
(
|
||||
polyPatch::New
|
||||
@ -1506,11 +1510,11 @@ int main(int argc, char *argv[])
|
||||
cMeshFace += defaultBoundaryFaces.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
newPatches.shrink();
|
||||
|
||||
// Use facePatchIDs map to reorder boundary faces into compact regions
|
||||
|
||||
|
||||
repatchPolyTopoChanger repatcher(pShapeMesh);
|
||||
|
||||
// Add new list of patches
|
||||
@ -1544,11 +1548,11 @@ int main(int argc, char *argv[])
|
||||
// Zones
|
||||
// will write out cell zones and internal faces for those zones
|
||||
// note: zone boundary faces are not added to face zones
|
||||
// the names of boundaries bordering on cell zones are written to
|
||||
// the names of boundaries bordering on cell zones are written to
|
||||
// a list containing the boundary name and cellzone it borders on
|
||||
// interior boundaries are handled via faceSets
|
||||
// cell zones will only be written if there is more than one
|
||||
|
||||
|
||||
if (writeZones && cellGroupZoneID.size()>1)
|
||||
{
|
||||
Info<< "Adding Zones" << endl;
|
||||
@ -1559,14 +1563,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Make face zones for cell zones
|
||||
List<faceZone*> fz(nrCellZones);
|
||||
|
||||
|
||||
// List of patch names and the cellZone(s) they border
|
||||
// this is just an info file to make MRF easier to setup
|
||||
// this is just an info file to make MRF easier to setup
|
||||
List<DynamicList<word> > boundaryZones
|
||||
(
|
||||
pShapeMesh.boundaryMesh().size()
|
||||
);
|
||||
|
||||
|
||||
const polyBoundaryMesh& bPatches = pShapeMesh.boundaryMesh();
|
||||
forAll(bPatches, pI)
|
||||
{
|
||||
@ -1591,7 +1595,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Mark zone cells, used for finding faces
|
||||
boolList zoneCell(pShapeMesh.nCells(), false);
|
||||
|
||||
|
||||
// shift cell indizes by 1
|
||||
label nr=0;
|
||||
for (label celli = (start() - 1); celli < end(); celli++)
|
||||
@ -1645,11 +1649,11 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cnt++;
|
||||
}
|
||||
|
||||
|
||||
pShapeMesh.addZones(pz, fz, cz);
|
||||
|
||||
forAll(bPatches, pI)
|
||||
@ -1676,10 +1680,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
Info<< endl << "Writing mesh..." << flush;
|
||||
|
||||
|
||||
Info<< " to " << pShapeMesh.instance()/pShapeMesh.meshDir()
|
||||
<< " " << flush;
|
||||
|
||||
|
||||
pShapeMesh.setInstance(pShapeMesh.instance());
|
||||
pShapeMesh.write();
|
||||
Info<< "done." << endl << endl;
|
||||
|
@ -78,7 +78,11 @@ label nValuesForPatchFaces = 0;
|
||||
// Dummy yywrap to keep yylex happy at compile time.
|
||||
// It is called by yylex but is not used as the mechanism to change file.
|
||||
// See <<EOF>>
|
||||
#if YY_FLEX_SUBMINOR_VERSION < 34
|
||||
extern "C" int yywrap()
|
||||
#else
|
||||
int yyFlexLexer::yywrap()
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -308,7 +312,7 @@ mtype {space}"MTYPE:"{space}
|
||||
|
||||
label nodeI(readLabel(nodeStream));
|
||||
|
||||
// Note: coordinates must be read one at the time.
|
||||
// Note: coordinates must be read one at the time.
|
||||
scalar x = readScalar(nodeStream);
|
||||
scalar y = readScalar(nodeStream);
|
||||
scalar z = readScalar(nodeStream);
|
||||
@ -676,7 +680,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
labelList pointLookup(maxPointIndex + 1, -1);
|
||||
|
||||
forAll (pointMap, pointI)
|
||||
@ -806,7 +810,7 @@ int main(int argc, char *argv[])
|
||||
]
|
||||
[curFaces[faceI] - 1] // this gives a fluent face - 1
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,11 @@ int yyFlexLexer::yylex()
|
||||
// Dummy yywrap to keep yylex happy at compile time.
|
||||
// It is called by yylex but is not used as the mechanism to change file.
|
||||
// See <<EOF>>
|
||||
#if YY_FLEX_SUBMINOR_VERSION < 34
|
||||
extern "C" int yywrap()
|
||||
#else
|
||||
int yyFlexLexer::yywrap()
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
%{
|
||||
@ -51,7 +51,11 @@ int yyFlexLexer::yylex()
|
||||
// Dummy yywrap to keep yylex happy at compile time.
|
||||
// It is called by yylex but is not used as the mechanism to change file.
|
||||
// See <<EOF>>
|
||||
#if YY_FLEX_SUBMINOR_VERSION < 34
|
||||
extern "C" int yywrap()
|
||||
#else
|
||||
int yyFlexLexer::yywrap()
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -391,7 +395,8 @@ bool triSurface::readSTLASCII(const fileName& STLfileName)
|
||||
// Create the lexer obtaining the approximate number of vertices in the STL
|
||||
// from the file size
|
||||
STLLexer lexer(&STLstream.stdStream(), Foam::size(STLfileName)/400);
|
||||
while(lexer.lex() != 0);
|
||||
while(lexer.lex() != 0)
|
||||
{}
|
||||
|
||||
DynamicList<STLpoint>& STLpoints = lexer.STLpoints();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user