diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.H index 0bf843f1c9074bd61a457db9bac1d4991b4024f2..211bd75d3951e2d9ddb8c0ad4f3b31b746f4007d 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.H @@ -115,7 +115,7 @@ private: { typedef typename Triangulation::Geom_traits Gt; - typedef std::pair<const typename Triangulation::Point*, int> + typedef std::pair<const typename Triangulation::Point*, label> Point_3; struct Less_x_3 diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshIO.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshIO.C index d987a8ad4f554ec33b78038151af77cd9a53c808..f429112ed5af7d16580c355bc2d72f21c8bfcf50 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshIO.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshIO.C @@ -450,7 +450,7 @@ Foam::DelaunayMesh<Triangulation>::createMesh } label faceI = 0; - labelList verticesOnTriFace(3, -1); + labelList verticesOnTriFace(3, label(-1)); face newFace(verticesOnTriFace); for @@ -461,7 +461,7 @@ Foam::DelaunayMesh<Triangulation>::createMesh ) { const Cell_handle c1(fit->first); - const int oppositeVertex = fit->second; + const label oppositeVertex = fit->second; const Cell_handle c2(c1->neighbor(oppositeVertex)); // Do not output if face has neither opposite vertex as an internal diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C index b598a7f5de7ae72435dd0045680faa7a9c086a03..322dc3f343f18a48fb9ed676948224043cb2329c 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C @@ -287,7 +287,7 @@ void Foam::DistributedDelaunayMesh<Triangulation>::findProcessorBoundaryCells // Cell_handle cit = *vcit; // // // Index of infinite vertex in this cell. -// int i = cit->index(Triangulation::infinite_vertex()); +// label i = cit->index(Triangulation::infinite_vertex()); // // Cell_handle c = cit->neighbor(i); // @@ -333,7 +333,7 @@ void Foam::DistributedDelaunayMesh<Triangulation>::findProcessorBoundaryCells if (Triangulation::is_infinite(cit)) { // Index of infinite vertex in this cell. - int i = cit->index(Triangulation::infinite_vertex()); + label i = cit->index(Triangulation::infinite_vertex()); Cell_handle c = cit->neighbor(i); diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.C index 49fc665e934c7c4686a34996b06c7c7ce47c0e9c..5866652b79c30a23478aaa57660d5e2ae15e92d8 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.C @@ -497,7 +497,7 @@ void Foam::searchableSurfaceControl::cellSizeFunctionVertices List<pointIndexHit> infoList(1, pointIndexHit()); vectorField normals(1); - labelList region(1, -1); + labelList region(1, label(-1)); forAll(points, pI) { diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index 2996493dbec4fa6f31fc9ca08a3c3d1f11ddb033..3fd302935af5c8ed85db52a5a89032b0349a9b41 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -43,7 +43,6 @@ SourceFiles #include "CGALTriangulation3Ddefs.H" #include "uint.H" -#include "ulong.H" #include "searchableSurfaces.H" #include "conformationSurfaces.H" #include "cellShapeControl.H" diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index df2c8c2f651602d08c030867ce9916319b4bf69b..17dac1c349f923696f9ffcf6bf33e0be311a85e7 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -172,7 +172,7 @@ void Foam::conformalVoronoiMesh::calcTetMesh label faceI = 0; - labelList verticesOnTriFace(3, -1); + labelList verticesOnTriFace(3, label(-1)); face newFace(verticesOnTriFace); @@ -184,7 +184,7 @@ void Foam::conformalVoronoiMesh::calcTetMesh ) { const Cell_handle c1(fit->first); - const int oppositeVertex = fit->second; + const label oppositeVertex = fit->second; const Cell_handle c2(c1->neighbor(oppositeVertex)); if (c1->hasFarPoint() && c2->hasFarPoint()) @@ -347,7 +347,7 @@ Foam::label Foam::conformalVoronoiMesh::mergeIdenticalDualVertices ) { const Cell_handle c1(fit->first); - const int oppositeVertex = fit->second; + const label oppositeVertex = fit->second; const Cell_handle c2(c1->neighbor(oppositeVertex)); if (is_infinite(c1) || is_infinite(c2)) @@ -1070,7 +1070,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality // Check for cells with one internal face only - labelList nInternalFaces(pMesh.nCells(), 0); + labelList nInternalFaces(pMesh.nCells(), label(0)); for (label fI = 0; fI < pMesh.nInternalFaces(); fI++) { @@ -1737,7 +1737,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches const label nPatches = patchNames.size(); - labelList procNeighbours(nPatches, -1); + labelList procNeighbours(nPatches, label(-1)); forAll(procNeighbours, patchI) { if (patchDicts[patchI].found("neighbProcNo")) @@ -2580,7 +2580,7 @@ void Foam::conformalVoronoiMesh::removeUnusedPoints label pointI = 0; - labelList oldToNew(pts.size(), -1); + labelList oldToNew(pts.size(), label(-1)); // Move all of the used points to the start of the pointField and // truncate it @@ -2637,7 +2637,7 @@ Foam::labelList Foam::conformalVoronoiMesh::removeUnusedCells label cellI = 0; - labelList oldToNew(cellUsed.size(), -1); + labelList oldToNew(cellUsed.size(), label(-1)); // Move all of the used cellCentres to the start of the pointField and // truncate it diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePoints.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePoints.C index f142470106b2df432714892cc6985ea36afd9bcd..f9d2e68981d5c3b211b15a1625fb5bfd64ae8712 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePoints.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePoints.C @@ -922,7 +922,7 @@ void Foam::conformalVoronoiMesh::createMultipleEdgePointGroup const List<extendedFeatureEdgeMesh::sideVolumeType>& normalVolumeTypes = feMesh.normalVolumeTypes(); - labelList nNormalTypes(4, 0); + labelList nNormalTypes(4, label(0)); forAll(edNormalIs, edgeNormalI) { diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H index 7d35594258dead100e872f25c60909fec799b2f4..e6896463d16dd041539a8d7fa574eb323755a07c 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H @@ -90,7 +90,7 @@ inline Foam::scalar Foam::conformalVoronoiMesh::averageAnyCellSize label nProducts = 0; const Cell_handle c(fit->first); - const int oppositeVertex = fit->second; + const label oppositeVertex = fit->second; for (label i = 0; i < 3; i++) { @@ -456,7 +456,7 @@ inline Foam::List<Foam::label> Foam::conformalVoronoiMesh::processorsAttached DynamicList<label> procsAttached(8); const Cell_handle c1(fit->first); - const int oppositeVertex = fit->second; + const label oppositeVertex = fit->second; const Cell_handle c2(c1->neighbor(oppositeVertex)); FixedList<label, 4> c1Procs(CGAL::indexedCellOps::processorsAttached(c1)); @@ -486,7 +486,7 @@ inline bool Foam::conformalVoronoiMesh::isParallelDualEdge ) const { const Cell_handle c1(fit->first); - const int oppositeVertex = fit->second; + const label oppositeVertex = fit->second; return ( diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C index 5b7612748ce4c5b565d106263a17a2c3674c8f6c..7fac1631ff22fd481e72ff8869ad927a6b70ab0f 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C @@ -542,7 +542,7 @@ void Foam::conformalVoronoiMesh::reorderPoints Info<< incrIndent << indent << "Reordering points into internal/external" << endl; - labelList oldToNew(points.size(), 0); + labelList oldToNew(points.size(), label(0)); // Find points that are internal for (label fI = nInternalFaces; fI < faces.size(); ++fI) @@ -645,8 +645,8 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches // } // Rotation on new faces. - labelList rotation(faces.size(), 0); - labelList faceMap(faces.size(), -1); + labelList rotation(faces.size(), label(0)); + labelList faceMap(faces.size(), label(-1)); PstreamBuffers pBufs(Pstream::nonBlocking); @@ -692,8 +692,8 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches const label patchStartFace = readLabel(patchDicts[patchI].lookup("startFace")); - labelList patchFaceMap(nPatchFaces, -1); - labelList patchFaceRotation(nPatchFaces, 0); + labelList patchFaceMap(nPatchFaces, label(-1)); + labelList patchFaceRotation(nPatchFaces, label(0)); bool changed = refCast<const processorPolyPatch>(pp).order ( diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C index 54a54ed6e91d82278c57360e03ec56e200695964..6d4e8ebcaac840256f16bf0b08c7547d3b996af4 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshTemplates.C @@ -83,7 +83,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh) meshSearch cellSearch(bMesh, polyMesh::FACEPLANES); - labelList cellVertices(bMesh.nCells(), 0); + labelList cellVertices(bMesh.nCells(), label(0)); for ( diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshZones.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshZones.C index e0915e01fbec7d42277e75b0f0c18e407dbeb885..dcbb61eec23cb8ec0d910b19366a563cf9447df0 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshZones.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshZones.C @@ -218,7 +218,7 @@ Foam::labelList Foam::conformalVoronoiMesh::calcCellZones const pointField& cellCentres ) const { - labelList cellToSurface(cellCentres.size(), -1); + labelList cellToSurface(cellCentres.size(), label(-1)); const PtrList<surfaceZonesInfo>& surfZones = geometryToConformTo().surfZones(); @@ -327,7 +327,7 @@ void Foam::conformalVoronoiMesh::calcFaceZones const labelList& faceOwner = mesh.faceOwner(); const labelList& faceNeighbour = mesh.faceNeighbour(); - labelList neiFaceOwner(mesh.nFaces() - mesh.nInternalFaces(), -1); + labelList neiFaceOwner(mesh.nFaces() - mesh.nInternalFaces(), label(-1)); const polyBoundaryMesh& patches = mesh.boundaryMesh(); diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformerSpecialisations.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformerSpecialisations.C index b12f56b909e49a829bd5a2c2d13b6d999adca936..682c30febca95c9b03c2eb715716313ce6a40664 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformerSpecialisations.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/featurePointConformer/featurePointConformerSpecialisations.C @@ -83,7 +83,7 @@ bool Foam::featurePointConformer::createSpecialisedFeaturePoint const labelListList& edgeNormals = feMesh.edgeNormals(); label concaveEdgeI = -1; - labelList convexEdgesI(2, -1); + labelList convexEdgesI(2, label(-1)); label nConvex = 0; forAll(pEds, i) @@ -521,7 +521,7 @@ bool Foam::featurePointConformer::createSpecialisedFeaturePoint const labelListList& edgeNormals = feMesh.edgeNormals(); label convexEdgeI = -1; - labelList concaveEdgesI(2, -1); + labelList concaveEdgesI(2, label(-1)); label nConcave = 0; forAll(pEds, i) diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H index cb805f7149388e54cb719ce00763e68e01e3286b..a43e6ef019deef1b98782c9d33553299c0e5efaa 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H @@ -97,7 +97,7 @@ class indexedCell // < 0 && > ctFar : the (global) index of a dual point on a processor // face - int index_; + Foam::label index_; //- The number of times that this Delaunay cell has been limited // during filtering @@ -154,9 +154,9 @@ public: // Member Functions - inline int& cellIndex(); + inline Foam::label& cellIndex(); - inline int cellIndex() const; + inline Foam::label cellIndex() const; #ifdef CGAL_INEXACT inline const Foam::point& dual(); diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H index d0ae6137a5d33211d65581ee86a22b0ee31f0722..fed87e61f211b422dc1168594d0dd388acb0b880 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H @@ -94,14 +94,14 @@ CGAL::indexedCell<Gt, Cb>::indexedCell // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Gt, class Cb> -int& CGAL::indexedCell<Gt, Cb>::cellIndex() +Foam::label& CGAL::indexedCell<Gt, Cb>::cellIndex() { return index_; } template<class Gt, class Cb> -int CGAL::indexedCell<Gt, Cb>::cellIndex() const +Foam::label CGAL::indexedCell<Gt, Cb>::cellIndex() const { return index_; } diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H index 4636062a8318976edd031fb70e3fa53005eb9381..2d9e7a7b6abe73f9db2e86c5fa30dcf81edff49c 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H @@ -112,7 +112,7 @@ class indexedVertex //- The index for this Delaunay vertex. For referred vertices, the // index is negative for vertices that are the outer (slave) of point // pairs - int index_; + Foam::label index_; //- Number of the processor that owns this vertex int processor_; @@ -154,7 +154,7 @@ public: inline indexedVertex ( const Point& p, - int index, + Foam::label index, vertexType type, int processor ); @@ -162,7 +162,7 @@ public: inline indexedVertex ( const Foam::point& p, - int index, + Foam::label index, vertexType type, int processor ); @@ -174,9 +174,9 @@ public: // Member Functions - inline int& index(); + inline Foam::label& index(); - inline int index() const; + inline Foam::label index() const; inline vertexType& type(); diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexI.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexI.H index 688e9f28e1e27f3598e345ceb5ebd6483557349b..b6ecbd91720b1d0f73cf7c364b62df87e22cc8ab 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexI.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexI.H @@ -91,7 +91,7 @@ template<class Gt, class Vb> inline CGAL::indexedVertex<Gt, Vb>::indexedVertex ( const Point& p, - int index, + Foam::label index, vertexType type, int processor ) @@ -110,7 +110,7 @@ template<class Gt, class Vb> inline CGAL::indexedVertex<Gt, Vb>::indexedVertex ( const Foam::point& p, - int index, + Foam::label index, vertexType type, int processor ) @@ -154,14 +154,14 @@ inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(Cell_handle f) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Gt, class Vb> -inline int& CGAL::indexedVertex<Gt, Vb>::index() +inline Foam::label& CGAL::indexedVertex<Gt, Vb>::index() { return index_; } template<class Gt, class Vb> -inline int CGAL::indexedVertex<Gt, Vb>::index() const +inline Foam::label CGAL::indexedVertex<Gt, Vb>::index() const { return index_; } diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C index 3552323d68000af903fa0e671f6548f41217bedb..56dd5d703f594e123927e88c7c2f8e64efb99ddd 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C @@ -299,7 +299,7 @@ bool Foam::autoDensity::fillBox { const conformationSurfaces& geometry = geometryToConformTo(); - unsigned int initialSize = initialPoints.size(); + label initialSize = initialPoints.size(); scalar maxCellSize = -GREAT; diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableBoxFeatures.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableBoxFeatures.C index 76726ccc07350008afd8393e91d08b0ac3d8291d..7e3d418fecd1f7179da993da08c7a87b39925163 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableBoxFeatures.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchableBoxFeatures.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -113,7 +113,7 @@ Foam::searchableBoxFeatures::features() const surfacePoints[treeBoundBox::edges[eI].end()] - surfacePoints[treeBoundBox::edges[eI].start()]; - normalDirections[eI] = labelList(2, 0); + normalDirections[eI] = labelList(2, label(0)); for (label j = 0; j < 2; ++j) { const vector cross = diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchablePlateFeatures.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchablePlateFeatures.C index a61862c43211820cdff1a05d0494e429770fb325..5a53eb9776e26ba14e785ff45b209b2db40c34ef 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchablePlateFeatures.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/searchableSurfaceFeatures/searchablePlateFeatures.C @@ -131,7 +131,7 @@ Foam::searchablePlateFeatures::features() const surface().points()()[edges[eI].end()] - surface().points()()[edges[eI].start()]; - normalDirections[eI] = labelList(2, 0); + normalDirections[eI] = labelList(2, label(0)); for (label j = 0; j < 2; ++j) { const vector cross = diff --git a/applications/utilities/mesh/generation/foamyQuadMesh/CV2D.C b/applications/utilities/mesh/generation/foamyQuadMesh/CV2D.C index ccdbb2b31e8bd2ff67eaf28663eb7ef6734c405a..2b16697fda68dfcd891d98fb63c4e35702eddbf4 100644 --- a/applications/utilities/mesh/generation/foamyQuadMesh/CV2D.C +++ b/applications/utilities/mesh/generation/foamyQuadMesh/CV2D.C @@ -28,7 +28,6 @@ License #include "transform.H" #include "IFstream.H" #include "uint.H" -#include "ulong.H" namespace Foam { diff --git a/applications/utilities/mesh/manipulation/setSet/writeFuns.C b/applications/utilities/mesh/manipulation/setSet/writeFuns.C index eb974ab2a9b3564ab6ae053433bf1e08e881c651..d11c81460d425d4f6aa389c0b77251dea101e3f2 100644 --- a/applications/utilities/mesh/manipulation/setSet/writeFuns.C +++ b/applications/utilities/mesh/manipulation/setSet/writeFuns.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,9 +43,9 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -void Foam::writeFuns::swapWord(label& word32) +void Foam::writeFuns::swapWord(int32_t& word32) { - char* mem = reinterpret_cast<char*>(&word32); + char* mem = reinterpret_cast<char*>(&word32); char a = mem[0]; mem[0] = mem[3]; @@ -57,9 +57,9 @@ void Foam::writeFuns::swapWord(label& word32) } -void Foam::writeFuns::swapWords(const label nWords, label* words32) +void Foam::writeFuns::swapWords(const label nWords, int32_t* words32) { - for (label i = 0; i < nWords; i++) + for (label i=0; i<nWords; i++) { swapWord(words32[i]); } @@ -75,9 +75,9 @@ void Foam::writeFuns::write { if (binary) { -# ifdef LITTLEENDIAN - swapWords(fField.size(), reinterpret_cast<label*>(fField.begin())); -# endif + #ifdef LITTLEENDIAN + swapWords(fField.size(), reinterpret_cast<int32_t*>(fField.begin())); + #endif os.write ( @@ -111,7 +111,6 @@ void Foam::writeFuns::write ) { List<floatScalar>& fld = fField.shrink(); - write(os, binary, fld); } @@ -125,9 +124,13 @@ void Foam::writeFuns::write { if (binary) { -# ifdef LITTLEENDIAN - swapWords(elems.size(), reinterpret_cast<label*>(elems.begin())); -# endif + #ifdef LITTLEENDIAN + swapWords + ( + (sizeof(label)/4)*elems.size(), + reinterpret_cast<int32_t*>(elems.begin()) + ); + #endif os.write ( reinterpret_cast<char*>(elems.begin()), @@ -160,12 +163,10 @@ void Foam::writeFuns::write ) { labelList& fld = elems.shrink(); - write(os, binary, fld); } -// Store vector in dest. void Foam::writeFuns::insert(const point& pt, DynamicList<floatScalar>& dest) { dest.append(float(pt.x())); @@ -174,7 +175,6 @@ void Foam::writeFuns::insert(const point& pt, DynamicList<floatScalar>& dest) } -// Store labelList in dest. void Foam::writeFuns::insert(const labelList& source, DynamicList<label>& dest) { forAll(source, i) @@ -184,7 +184,6 @@ void Foam::writeFuns::insert(const labelList& source, DynamicList<label>& dest) } -// Store scalarField in dest void Foam::writeFuns::insert ( const List<scalar>& source, @@ -198,7 +197,6 @@ void Foam::writeFuns::insert } -// Store scalarField (indexed through map) in dest void Foam::writeFuns::insert ( const labelList& map, diff --git a/applications/utilities/mesh/manipulation/setSet/writeFuns.H b/applications/utilities/mesh/manipulation/setSet/writeFuns.H index 73e77eef2d79ecdb3d3b7a372c1dfbde3722a3f7..51c1ed8509fb0027d435848c1cf5f05b5a8d96b0 100644 --- a/applications/utilities/mesh/manipulation/setSet/writeFuns.H +++ b/applications/utilities/mesh/manipulation/setSet/writeFuns.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,12 @@ Class Description Various functions for collecting and writing binary data. + The LITTLE_ENDIAN is based on 32bit words. + It is not clear how 64bit labels should be handled, currently they are + split into two 32bit words and swapWord applied to these two. + + writeFuns should be a namespace rather than a class. + SourceFiles writeFuns.C @@ -41,43 +47,54 @@ SourceFiles #include "DynamicList.H" #include "point.H" -using namespace Foam; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - /*---------------------------------------------------------------------------*\ Class writeFuns Declaration \*---------------------------------------------------------------------------*/ class writeFuns { - //- Swap halves of word. - static void swapWord(label& word32); - static void swapWords(const label nWords, label* words32); + // Private member functions + + //- Swap halves of word + static void swapWord(int32_t& word32); + + //- Swap halves of word + static void swapWords(const label nWords, int32_t* words32); + public: - //- Write ascii or binary. If binary optionally in-place swaps argument + //- Write floats ascii or binary. + // If binary optionally in-place swaps argument static void write(std::ostream&, const bool, DynamicList<floatScalar>&); + + //- Write labels ascii or binary. + // If binary optionally in-place swaps argument static void write(std::ostream&, const bool, DynamicList<label>&); - //- Write ascii or binary. If binary optionally in-place swaps argument + //- Write floats ascii or binary. + // If binary optionally in-place swaps argument static void write(std::ostream&, const bool, List<floatScalar>&); + + //- Write labels ascii or binary. + // If binary optionally in-place swaps argument static void write(std::ostream&, const bool, labelList&); - //- Append point to DynamicList + //- Append point to given DynamicList static void insert(const point&, DynamicList<floatScalar>& dest); - //- Append elements of labelList to DynamicList + //- Append elements of labelList to given DynamicList static void insert(const labelList&, DynamicList<label>&); - //- Append elements of scalarList to DynamicList + + //- Append elements of scalarList to given DynamicList static void insert(const List<scalar>&, DynamicList<floatScalar>&); - //- Append elements of scalarList to DynamicList using map + //- Append elements of scalarList to given DynamicList using map static void insert ( const labelList& map, @@ -85,16 +102,16 @@ public: DynamicList<floatScalar>& ); - //- Append points to DynamicList of floats + //- Append points to given DynamicList of floats static void insert(const List<point>& source, DynamicList<floatScalar>&); - //- As above but using map + + //- Append points to given DynamicList of floats using map static void insert ( const labelList& map, const List<point>& source, DynamicList<floatScalar>& ); - }; diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt index 94d1763a20793698cc1cc5d2414da19d563cf413..4b37871f584216f9d7aedb87d773c1fbbc82ce03 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt @@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES( ADD_DEFINITIONS( -DWM_$ENV{WM_PRECISION_OPTION} + -DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE} ) # Set output library destination to plugin directory diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C index e8fdd0b886ab69c290e09aa136b2c1aed4f65359..f786753491e051154554d53fefde4061b8ccc4c2 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C @@ -31,7 +31,6 @@ License #include "cellModeller.H" #include "vtkOpenFOAMPoints.H" #include "Swap.H" -#include "longLong.H" // VTK includes #include "vtkCellArray.h" diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt index 8166a78a8d69a24f2a597735168dfde2b8ed6ff3..60aaad3f625dc6666fd25534190202123b9446bf 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt @@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES( ADD_DEFINITIONS( -DWM_$ENV{WM_PRECISION_OPTION} + -DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE} ) # Set output library destination to plugin directory diff --git a/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/PV4FoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/PV4FoamReader/CMakeLists.txt index 4c2d5158b789ac6aebabaa03413ce47a445c38c1..65c25ae50724fcd8afc8c9dc4032d578d6b34ea4 100644 --- a/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/PV4FoamReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/PV4FoamReader/CMakeLists.txt @@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES( ADD_DEFINITIONS( -DWM_$ENV{WM_PRECISION_OPTION} + -DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE} ) # Set output library destination to plugin directory diff --git a/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4FoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4FoamMeshVolume.C index 317b370082735a5fc48c516422a375bc0ff70292..54e91486ccb31c9facfde02d4fd1286071d90605 100644 --- a/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4FoamMeshVolume.C +++ b/applications/utilities/postProcessing/graphics/PV4Readers/PV4FoamReader/vtkPV4Foam/vtkPV4FoamMeshVolume.C @@ -31,7 +31,6 @@ License #include "cellModeller.H" #include "vtkOpenFOAMPoints.H" #include "Swap.H" -#include "longLong.H" // VTK includes #include "vtkCellArray.h" diff --git a/applications/utilities/postProcessing/graphics/PV4Readers/PV4blockMeshReader/PV4blockMeshReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV4Readers/PV4blockMeshReader/PV4blockMeshReader/CMakeLists.txt index 72003c881543701899f29334a303f0311eedff68..d081db2ff6ceb0fbd256a6a6c14c268d9036ea91 100644 --- a/applications/utilities/postProcessing/graphics/PV4Readers/PV4blockMeshReader/PV4blockMeshReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PV4Readers/PV4blockMeshReader/PV4blockMeshReader/CMakeLists.txt @@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES( ADD_DEFINITIONS( -DWM_$ENV{WM_PRECISION_OPTION} + -DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE} ) # Set output library destination to plugin directory diff --git a/etc/bashrc b/etc/bashrc index 3fec1e4351b0cc81fea709fbd5b9c2a5ab0526ba..5618894b5d80bedb7c246dd7b3ae7a8eca64871e 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -74,6 +74,10 @@ export WM_ARCH_OPTION=64 # WM_PRECISION_OPTION = DP | SP export WM_PRECISION_OPTION=DP +#- Label size: +# WM_LABEL_SIZE = 32 | 64 +export WM_LABEL_SIZE=32 + #- Optimised, debug, profiling: # WM_COMPILE_OPTION = Opt | Debug | Prof export WM_COMPILE_OPTION=Opt diff --git a/etc/config/CGAL.csh b/etc/config/CGAL.csh index 5f7dceecc266dc830ac44d18774df83dc06d11f6..9d6058d01c01db2534900446c869c55ed9fb215e 100644 --- a/etc/config/CGAL.csh +++ b/etc/config/CGAL.csh @@ -30,7 +30,7 @@ ##------------------------------------------------------------------------------ set boost_version=boost-system -set cgal_version=CGAL-4.3 +set cgal_version=CGAL-4.5.1 setenv BOOST_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version setenv CGAL_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version diff --git a/etc/config/CGAL.sh b/etc/config/CGAL.sh index dc8772dd16ab16d1432d486bb2bdd8dece255f41..0760140f4b5e04349c0baaf53ef3e489fdb042fb 100644 --- a/etc/config/CGAL.sh +++ b/etc/config/CGAL.sh @@ -30,7 +30,7 @@ #------------------------------------------------------------------------------ boost_version=boost-system -cgal_version=CGAL-4.3 +cgal_version=CGAL-4.5.1 export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version diff --git a/etc/config/scotch.sh b/etc/config/scotch.sh index 1ee06e80b87b298f1b7bea4497422d42d7ed32d6..2ef01c8c48d7dfa16dd21c7639bc6d1bdcc5b987 100644 --- a/etc/config/scotch.sh +++ b/etc/config/scotch.sh @@ -34,6 +34,6 @@ #------------------------------------------------------------------------------ export SCOTCH_VERSION=scotch_6.0.0 -export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$SCOTCH_VERSION +export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_LABEL_OPTION/$SCOTCH_VERSION # ----------------------------------------------------------------------------- diff --git a/etc/config/settings.csh b/etc/config/settings.csh index 2138bb2369f4b51164734272e254d66d86607002..6da932a43530006a36839f123d773452428adf3c 100644 --- a/etc/config/settings.csh +++ b/etc/config/settings.csh @@ -142,7 +142,8 @@ setenv FOAM_JOB_DIR $WM_PROJECT_INST_DIR/jobControl # wmake configuration setenv WM_DIR $WM_PROJECT_DIR/wmake setenv WM_LINK_LANGUAGE c++ -setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION +setenv WM_LABEL_OPTION Int$WM_LABEL_SIZE +setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION$WM_COMPILE_OPTION # base executables/libraries setenv FOAM_APPBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin diff --git a/etc/config/settings.sh b/etc/config/settings.sh index aab770ef69b43303f42a18d6f768ed6a73b0c7ce..c4fa06d956b5689758eb562b5c7d33793dfa0fe6 100644 --- a/etc/config/settings.sh +++ b/etc/config/settings.sh @@ -170,7 +170,8 @@ export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl # wmake configuration export WM_DIR=$WM_PROJECT_DIR/wmake export WM_LINK_LANGUAGE=c++ -export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION +export WM_LABEL_OPTION=Int$WM_LABEL_SIZE +export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION$WM_COMPILE_OPTION # base executables/libraries export FOAM_APPBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin diff --git a/etc/cshrc b/etc/cshrc index 7919fe411269b6d5243a5ecb174d4d584a2cbe46..07ca5cb34d0c754501134a1ae6749e3e10c945f3 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -74,6 +74,10 @@ setenv WM_ARCH_OPTION 64 # WM_PRECISION_OPTION = DP | SP setenv WM_PRECISION_OPTION DP +#- Label size: +# WM_LABEL_SIZE = 32 | 64 +setenv WM_LABEL_SIZE 32 + #- Optimised, debug, profiling: # WM_COMPILE_OPTION = Opt | Debug | Prof setenv WM_COMPILE_OPTION Opt diff --git a/src/OSspecific/POSIX/fileMonitor.C b/src/OSspecific/POSIX/fileMonitor.C index 870e71d8e7eb2b0a462097c6a856379893c47233..d704a1800c48b0dbf83a535ae0b8035256eca3bb 100644 --- a/src/OSspecific/POSIX/fileMonitor.C +++ b/src/OSspecific/POSIX/fileMonitor.C @@ -327,7 +327,7 @@ void Foam::fileMonitor::checkFiles() const else if (FD_ISSET(watcher_->inotifyFd_, &fdSet)) { // Read events - ssize_t nBytes = read + ssize_t nBytes = ::read ( watcher_->inotifyFd_, buffer, diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 7f3f5f82c6e80b5b77751f2d09a161f67529bd8b..d7c517d1b1c1881d31cb4e786cedb80b0622bb20 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -16,11 +16,16 @@ $(chars)/char/charIO.C $(chars)/wchar/wcharIO.C ints = primitives/ints -$(ints)/int/intIO.C +$(ints)/uint32/uint32.C +$(ints)/uint32/uint32IO.C +$(ints)/uint64/uint64.C +$(ints)/uint64/uint64IO.C $(ints)/uint/uintIO.C -$(ints)/long/longIO.C -$(ints)/longLong/longLongIO.C -$(ints)/ulong/ulongIO.C +$(ints)/int32/int32.C +$(ints)/int32/int32IO.C +$(ints)/int64/int64.C +$(ints)/int64/int64IO.C +$(ints)/int/intIO.C $(ints)/label/label.C $(ints)/uLabel/uLabel.C $(ints)/lists/labelIOList.C diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C index 4757dbb0f7f9d3f69001bba8cd38699486f8c607..aee4db6a2cedba5dbc5a10cfcd49ce5190e294ba 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C @@ -27,7 +27,6 @@ License #include "DLListBase.H" #include "IOstreams.H" -#include "long.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H index 48a6ad2fa21b0478751cb901569cbc58b755a863..0997c2b56facd952d962775ac4fdaa868f295971 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H @@ -122,8 +122,11 @@ public: const bool quoted=true ) = 0; - //- Write label - virtual Ostream& write(const label) = 0; + //- Write int32_t + virtual Ostream& write(const int32_t) = 0; + + //- Write int64_t + virtual Ostream& write(const int64_t) = 0; //- Write floatScalar virtual Ostream& write(const floatScalar) = 0; diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C index 971229ee3a769ebbb7dddf4e3c004a8981e0e7b6..cd3cba54ba0188300c41f6c29c26043fd222b024 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C @@ -254,7 +254,15 @@ Foam::Ostream& Foam::UOPstream::writeQuoted } -Foam::Ostream& Foam::UOPstream::write(const label val) +Foam::Ostream& Foam::UOPstream::write(const int32_t val) +{ + write(char(token::LABEL)); + writeToBuffer(val); + return *this; +} + + +Foam::Ostream& Foam::UOPstream::write(const int64_t val) { write(char(token::LABEL)); writeToBuffer(val); diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H index effcc4e31201a3892701a2df49c91369780d7e3e..94440a244fca5d5734fc58b19fe11f122aec4866 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.H @@ -156,8 +156,11 @@ public: const bool quoted=true ); - //- Write label - Ostream& write(const label); + //- Write int32_t + virtual Ostream& write(const int32_t); + + //- Write int64_t + Ostream& write(const int64_t); //- Write floatScalar Ostream& write(const floatScalar); diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C index e975cd4b8924c3800eade23eed978b8449ea7710..5f8a976c0f101a0ffbcf2bbd4332db2ff680f49f 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C @@ -409,7 +409,12 @@ Foam::UPstream::treeCommunication_(10); // Allocate a serial communicator. This gets overwritten in parallel mode // (by UPstream::setParRun()) -Foam::UPstream::communicator serialComm(-1, Foam::labelList(1, 0), false); +Foam::UPstream::communicator serialComm +( + -1, + Foam::labelList(1, Foam::label(0)), + false +); diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H index 73a6388b9737a89a72133166bce7e95ab1b8ba29..e0a4f0040a3cb5d6c77d2191d0e942974acba7af 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H @@ -413,7 +413,7 @@ public: } //- Process ID of given process index - static List<int>& procID(int communicator) + static List<int>& procID(label communicator) { return procIDs_[communicator]; } diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/exchange.C b/src/OpenFOAM/db/IOstreams/Pstreams/exchange.C index 62cce15f7d043dfb251194c0eabdd7a79e82518a..ddc39244f6fc1a898c646b934e1dd67c7497dd0d 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/exchange.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/exchange.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,16 +31,10 @@ Description #include "PstreamCombineReduceOps.H" #include "UPstream.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -//template<template<class> class ListType, class T> template<class Container, class T> -void Pstream::exchange +void Foam::Pstream::exchange ( const List<Container>& sendBufs, List<Container>& recvBufs, @@ -55,7 +49,7 @@ void Pstream::exchange FatalErrorIn ( "Pstream::exchange(..)" - ) << "Continuous data only." << Foam::abort(FatalError); + ) << "Continuous data only." << sizeof(T) << Foam::abort(FatalError); } if (sendBufs.size() != UPstream::nProcs(comm)) @@ -153,8 +147,4 @@ void Pstream::exchange } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C index 3c7d266520ac79142bc877eac24e4ff61d85e196..406567a9478c7347a243e3736a09b279765fb593 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C @@ -350,8 +350,8 @@ Foam::Istream& Foam::ISstream::read(token& t) { if (asLabel) { - label labelVal; - if (readLabel(buf, labelVal)) + label labelVal = 0; + if (Foam::read(buf, labelVal)) { t = labelVal; } @@ -367,21 +367,6 @@ Foam::Istream& Foam::ISstream::read(token& t) { t.setBad(); } -// --------------------------------------- -// this would also be possible if desired: -// --------------------------------------- -// // return as a label when possible -// // eg, 1E6 -> 1000000 -// if (scalarVal <= labelMax && scalarVal >= labelMin) -// { -// label labelVal(scalarVal); -// -// if (labelVal == scalarVal) -// { -// t = labelVal; -// } -// } - } } else diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C index 90f77a4802a33decf4508862c0dd921fb5030589..bc0624299339957b8d254f032d4aeeb68d90d226 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C @@ -183,7 +183,15 @@ Foam::Ostream& Foam::OSstream::writeQuoted } -Foam::Ostream& Foam::OSstream::write(const label val) +Foam::Ostream& Foam::OSstream::write(const int32_t val) +{ + os_ << val; + setState(os_.rdstate()); + return *this; +} + + +Foam::Ostream& Foam::OSstream::write(const int64_t val) { os_ << val; setState(os_.rdstate()); diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H index 8d2ef11dfc4778814c7558751c6954e95c782aa4..ba840698f7d92aea7befd102da7d95ea5b7bd1e5 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H @@ -130,8 +130,11 @@ public: const bool quoted=true ); - //- Write label - virtual Ostream& write(const label); + //- Write int32_t + virtual Ostream& write(const int32_t); + + //- Write int64_t + virtual Ostream& write(const int64_t); //- Write floatScalar virtual Ostream& write(const floatScalar); diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C index a1b80fe57bfd47b76b11aa00f8388dd46d6cc06f..f290d94ce7adbe062d312ae7d63f54d7d60a7a68 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.C @@ -137,7 +137,14 @@ Foam::Ostream& Foam::prefixOSstream::writeQuoted } -Foam::Ostream& Foam::prefixOSstream::write(const label val) +Foam::Ostream& Foam::prefixOSstream::write(const int32_t val) +{ + checkWritePrefix(); + return OSstream::write(val); +} + + +Foam::Ostream& Foam::prefixOSstream::write(const int64_t val) { checkWritePrefix(); return OSstream::write(val); diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H index b6d824da467aaa0929245350f44ecbf1153a5085..89a7b62771f666f9ab485c57fb4ece2df847e24a 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/prefixOSstream.H @@ -121,8 +121,11 @@ public: const bool quoted=true ); - //- Write label - virtual Ostream& write(const label); + //- Write int32_t + virtual Ostream& write(const int32_t); + + //- Write int64_t + virtual Ostream& write(const int64_t); //- Write floatScalar virtual Ostream& write(const floatScalar); diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C index 43229b18fd2ffe9b6eb92f9efa063b882e43dd42..d1f2f209d3ff16160e844a9e6643352e31fddd0c 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,13 +25,13 @@ License #include "dlLibraryTable.H" #include "OSspecific.H" -#include "long.H" +#include "int.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -defineTypeNameAndDebug(dlLibraryTable, 0); + defineTypeNameAndDebug(dlLibraryTable, 0); } @@ -63,7 +63,7 @@ Foam::dlLibraryTable::~dlLibraryTable() { Info<< "dlLibraryTable::~dlLibraryTable() : closing " << libNames_[i] - << " with handle " << long(libPtrs_[i]) << endl; + << " with handle " << uintptr_t(libPtrs_[i]) << endl; } dlClose(libPtrs_[i]); } @@ -86,7 +86,7 @@ bool Foam::dlLibraryTable::open if (debug) { Info<< "dlLibraryTable::open : opened " << functionLibName - << " resulting in handle " << long(functionLibPtr) << endl; + << " resulting in handle " << uintptr_t(functionLibPtr) << endl; } if (!functionLibPtr) @@ -137,7 +137,7 @@ bool Foam::dlLibraryTable::close if (debug) { Info<< "dlLibraryTable::close : closing " << functionLibName - << " with handle " << long(libPtrs_[index]) << endl; + << " with handle " << uintptr_t(libPtrs_[index]) << endl; } bool ok = dlClose(libPtrs_[index]); diff --git a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C index b5a49f68817e8f5dcb5567f1c47e2f2a7b6d2664..d38814f6228422f75e6d86746a4df7b0ff301784 100644 --- a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C +++ b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C @@ -530,7 +530,7 @@ TMP_UNARY_FUNCTION(Type, average) #define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc) \ \ template<class Type> \ -ReturnType gFunc(const UList<Type>& f, const int comm) \ +ReturnType gFunc(const UList<Type>& f, const label comm) \ { \ ReturnType res = Func(f); \ reduce(res, rFunc##Op<Type>(), Pstream::msgType(), comm); \ @@ -554,7 +554,7 @@ scalar gSumProd ( const UList<Type>& f1, const UList<Type>& f2, - const int comm + const label comm ) { scalar SumProd = sumProd(f1, f2); @@ -567,7 +567,7 @@ Type gSumCmptProd ( const UList<Type>& f1, const UList<Type>& f2, - const int comm + const label comm ) { Type SumProd = sumCmptProd(f1, f2); @@ -579,7 +579,7 @@ template<class Type> Type gAverage ( const UList<Type>& f, - const int comm + const label comm ) { label n = f.size(); diff --git a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H index 4c51262f9e36c9f76e1489c1ab31cb6280ca0348..a5ecff56cf884fca2d00efdde1f8b228b39e2e55 100644 --- a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H +++ b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H @@ -212,7 +212,7 @@ TMP_UNARY_FUNCTION(Type, average) #define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc) \ \ template<class Type> \ -ReturnType gFunc(const UList<Type>& f, const int comm = UPstream::worldComm); \ +ReturnType gFunc(const UList<Type>& f, const label comm = UPstream::worldComm);\ TMP_UNARY_FUNCTION(ReturnType, gFunc) G_UNARY_FUNCTION(Type, gMax, max, max) @@ -231,7 +231,7 @@ scalar gSumProd ( const UList<Type>& f1, const UList<Type>& f2, - const int comm = UPstream::worldComm + const label comm = UPstream::worldComm ); template<class Type> @@ -239,14 +239,14 @@ Type gSumCmptProd ( const UList<Type>& f1, const UList<Type>& f2, - const int comm = UPstream::worldComm + const label comm = UPstream::worldComm ); template<class Type> Type gAverage ( const UList<Type>& f, - const int comm = UPstream::worldComm + const label comm = UPstream::worldComm ); TMP_UNARY_FUNCTION(Type, gAverage) diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H index 14052f8a87654a2d78f452cdec44172af2de7cb8..384467b03266af3af0998b83f4eba00aaa653257 100644 --- a/src/OpenFOAM/include/OSspecific.H +++ b/src/OpenFOAM/include/OSspecific.H @@ -37,7 +37,6 @@ SourceFiles #define OSspecific_H #include "fileNameList.H" -#include "long.H" #include <sys/types.h> diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H index 65d10613ee64e96e2df977e7383071335673cbf4..3b784d3bb2539b20088315f206a338646da75b32 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H @@ -85,7 +85,7 @@ public: // Access //- Return communicator used for parallel communication - virtual int comm() const = 0; + virtual label comm() const = 0; //- Return processor number (rank in communicator) virtual int myProcNo() const = 0; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H index 82ff49fb6feb4ea0e51b5455fe0dfb3e4dcf88a4..9ebbe16e2aa95bc2e3bba900b389b0edee38dedf 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H @@ -72,7 +72,7 @@ public: // Access //- Return communicator used for comms - virtual int comm() const = 0; + virtual label comm() const = 0; //- Return processor number virtual int myProcNo() const = 0; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C index 066aa39d3b3bef9cbd4ee5bdf03261c3211c7214..9d933ee3b781612240a6783e6b50a12c6558faf3 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C @@ -677,7 +677,7 @@ void Foam::GAMGAgglomeration::calculateRegionMaster const label comm, const labelList& procAgglomMap, labelList& masterProcs, - List<int>& agglomProcIDs + List<label>& agglomProcIDs ) { // Determine the master processors diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H index 37cf4a91973f0a366fba4c0968b13034103c58c9..8f0ff18d41a8f341484bbb2ca2b1aed482fb6cf8 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.H @@ -435,7 +435,7 @@ public: const label comm, const labelList& procAgglomMap, labelList& masterProcs, - List<int>& agglomProcIDs + List<label>& agglomProcIDs ); //- Whether to agglomerate across processors diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerationTemplates.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerationTemplates.C index 39d69458e2d61c1256d99bcc52a7a64caddccb07..b8b142d84ad06afe20e28888e2238d3bf9b63f22 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerationTemplates.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerationTemplates.C @@ -34,7 +34,6 @@ void Foam::GAMGAgglomeration::gatherList ( const label comm, const labelList& procIDs, - const Type& myVal, List<Type>& allVals, const int tag @@ -123,7 +122,7 @@ void Foam::GAMGAgglomeration::restrictField { label fineComm = UPstream::parent(procCommunicator_[coarseLevelIndex]); - const List<int>& procIDs = agglomProcIDs(coarseLevelIndex); + const List<label>& procIDs = agglomProcIDs(coarseLevelIndex); const labelList& offsets = cellOffsets(coarseLevelIndex); globalIndex::gather @@ -196,7 +195,7 @@ void Foam::GAMGAgglomeration::prolongField procCommunicator_[coarseLevelIndex] ); - const List<int>& procIDs = agglomProcIDs(coarseLevelIndex); + const List<label>& procIDs = agglomProcIDs(coarseLevelIndex); const labelList& offsets = cellOffsets(coarseLevelIndex); label localSize = nCells_[levelIndex]; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/GAMGProcAgglomeration/GAMGProcAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/GAMGProcAgglomeration/GAMGProcAgglomeration.C index d3a83dac79c179e796bb3fb5219217891d132e44..2c2e052bed271d041f3ac58204c9c7e981ff0bc9 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/GAMGProcAgglomeration/GAMGProcAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/GAMGProcAgglomeration/GAMGProcAgglomeration.C @@ -266,7 +266,7 @@ bool Foam::GAMGProcAgglomeration::agglomerate const label fineLevelIndex, const labelList& procAgglomMap, const labelList& masterProcs, - const List<int>& agglomProcIDs, + const List<label>& agglomProcIDs, const label procAgglomComm ) { diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/GAMGProcAgglomeration/GAMGProcAgglomeration.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/GAMGProcAgglomeration/GAMGProcAgglomeration.H index c3acc015219aae41fead1a03b5da4b64713b6aca..b602779b30c126e02b70e0abfd1f6812cceace44 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/GAMGProcAgglomeration/GAMGProcAgglomeration.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/GAMGProcAgglomeration/GAMGProcAgglomeration.H @@ -71,7 +71,7 @@ protected: const label fineLevelIndex, const labelList& procAgglomMap, const labelList& masterProcs, - const List<int>& agglomProcIDs, + const List<label>& agglomProcIDs, const label procAgglomComm ); diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/eagerGAMGProcAgglomeration/eagerGAMGProcAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/eagerGAMGProcAgglomeration/eagerGAMGProcAgglomeration.C index c1f166d1ec3a4c1f1376bea067c572302779bb18..ba4da8081fc0202fa6041919ceefae8f5464964e 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/eagerGAMGProcAgglomeration/eagerGAMGProcAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/eagerGAMGProcAgglomeration/eagerGAMGProcAgglomeration.C @@ -116,7 +116,7 @@ bool Foam::eagerGAMGProcAgglomeration::agglomerate() labelList masterProcs; // Local processors that agglomerate. agglomProcIDs[0] // is in masterProc. - List<int> agglomProcIDs; + List<label> agglomProcIDs; GAMGAgglomeration::calculateRegionMaster ( levelComm, diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/masterCoarsestGAMGProcAgglomeration/masterCoarsestGAMGProcAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/masterCoarsestGAMGProcAgglomeration/masterCoarsestGAMGProcAgglomeration.C index 480795fb558b0b0da85fed8218006ecec9624ce9..6f097c19c9d7f71ef421d9049083d20db3520b5a 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/masterCoarsestGAMGProcAgglomeration/masterCoarsestGAMGProcAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/masterCoarsestGAMGProcAgglomeration/masterCoarsestGAMGProcAgglomeration.C @@ -104,7 +104,7 @@ bool Foam::masterCoarsestGAMGProcAgglomeration::agglomerate() labelList masterProcs; // Local processors that agglomerate. agglomProcIDs[0] is in // masterProc. - List<int> agglomProcIDs; + List<label> agglomProcIDs; GAMGAgglomeration::calculateRegionMaster ( levelComm, diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.C index 6e13d52c993de47c4cb65b94c137f2865b4b414a..3002169e645949703ef3e62b23351114fe9ede59 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.C @@ -151,7 +151,7 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration label singleCellMeshComm = UPstream::allocateCommunicator ( mesh.comm(), - labelList(1, 0) // only processor 0 + labelList(1, label(0)) // only processor 0 ); scalarField faceWeights; @@ -283,7 +283,7 @@ bool Foam::procFacesGAMGProcAgglomeration::agglomerate() labelList masterProcs; // Local processors that agglomerate. agglomProcIDs[0] is in // masterProc. - List<int> agglomProcIDs; + List<label> agglomProcIDs; GAMGAgglomeration::calculateRegionMaster ( levelComm, diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.C index c47c0aeee6ef82b7c420b40450a1dfaccd71c4a8..a68475bfab2b95b62a7006e8afad4fa2ab33881f 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.C @@ -164,7 +164,7 @@ Foam::GAMGSolver::GAMGSolver const labelList& procAgglomMap = agglomeration_.procAgglomMap(fineLevelIndex+1); - const List<int>& procIDs = + const List<label>& procIDs = agglomeration_.agglomProcIDs(fineLevelIndex+1); procAgglomerateMatrix diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H index 7dcd045ee466579ed2f9c90a3c042268178cf5b2..40c67d2bb3aacf50b12561e4cdf583511d848673 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H @@ -194,7 +194,7 @@ class GAMGSolver PtrList<FieldField<Field, scalar> >& otherBouCoeffs, PtrList<FieldField<Field, scalar> >& otherIntCoeffs, List<boolList>& otherTransforms, - List<List<int> >& otherRanks + List<List<label> >& otherRanks ) const; //- Agglomerate processor matrices @@ -202,7 +202,7 @@ class GAMGSolver ( // Agglomeration information const labelList& procAgglomMap, - const List<int>& agglomProcIDs, + const List<label>& agglomProcIDs, const label levelI, @@ -218,7 +218,7 @@ class GAMGSolver void procAgglomerateMatrix ( const labelList& procAgglomMap, - const List<int>& agglomProcIDs, + const List<label>& agglomProcIDs, const label levelI ); diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C index dc3cad105187641fb5d97c942fd515890016eeb6..6860e55f2f525cb549ef6eecb2c9c47855f938c3 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C @@ -296,7 +296,7 @@ void Foam::GAMGSolver::gatherMatrices PtrList<FieldField<Field, scalar> >& otherBouCoeffs, PtrList<FieldField<Field, scalar> >& otherIntCoeffs, List<boolList>& otherTransforms, - List<List<int> >& otherRanks + List<List<label> >& otherRanks ) const { if (debug) @@ -332,7 +332,7 @@ void Foam::GAMGSolver::gatherMatrices // Receive number of/valid interfaces boolList& procTransforms = otherTransforms[otherI]; - List<int>& procRanks = otherRanks[otherI]; + List<label>& procRanks = otherRanks[otherI]; fromSlave >> procTransforms; fromSlave >> procRanks; @@ -372,7 +372,7 @@ void Foam::GAMGSolver::gatherMatrices // Count valid interfaces boolList procTransforms(interfaceBouCoeffs.size(), false); - List<int> procRanks(interfaceBouCoeffs.size(), -1); + List<label> procRanks(interfaceBouCoeffs.size(), -1); forAll(interfaces, intI) { if (interfaces.set(intI)) @@ -415,7 +415,7 @@ void Foam::GAMGSolver::procAgglomerateMatrix ( // Agglomeration information const labelList& procAgglomMap, - const List<int>& agglomProcIDs, + const List<label>& agglomProcIDs, const label levelI, @@ -451,7 +451,7 @@ void Foam::GAMGSolver::procAgglomerateMatrix PtrList<FieldField<Field, scalar> > otherBouCoeffs; PtrList<FieldField<Field, scalar> > otherIntCoeffs; List<boolList> otherTransforms; - List<List<int> > otherRanks; + List<List<label> > otherRanks; gatherMatrices ( agglomProcIDs, @@ -745,7 +745,7 @@ void Foam::GAMGSolver::procAgglomerateMatrix void Foam::GAMGSolver::procAgglomerateMatrix ( const labelList& procAgglomMap, - const List<int>& agglomProcIDs, + const List<label>& agglomProcIDs, const label levelI ) diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H index c86ee5c05f9089c2b0f4208809f082ee11fd4ca9..1cadfe44fdbd90351143e30a18472f90c0277d7b 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.H @@ -155,7 +155,7 @@ public: //- Processor interface functions //- Return communicator used for comms - virtual int comm() const + virtual label comm() const { return procInterface_.comm(); } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H index 3d0c9d28c30aa9f018932d6ba399f950ae43622b..0a157d416fe0a23a4e914cb6f3ce927ce604bd53 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorGAMGInterface/processorGAMGInterface.H @@ -148,7 +148,7 @@ public: //- Processor interface functions //- Return communicator used for sending - virtual int comm() const + virtual label comm() const { return comm_; } diff --git a/src/OpenFOAM/meshes/lduMesh/lduMesh.H b/src/OpenFOAM/meshes/lduMesh/lduMesh.H index 7a092a676dcbd3f6887222edefa95e52f0c29c21..4564c2249dee19334ec492c297e2cb963e782231 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduMesh.H +++ b/src/OpenFOAM/meshes/lduMesh/lduMesh.H @@ -80,7 +80,7 @@ public: virtual lduInterfacePtrsList interfaces() const = 0; //- Return communicator used for parallel communication - virtual int comm() const = 0; + virtual label comm() const = 0; //- Helper: reduce with current communicator template<class T, class BinaryOp> diff --git a/src/OpenFOAM/primitives/contiguous/contiguous.H b/src/OpenFOAM/primitives/contiguous/contiguous.H index 7a237d031c482fc0c3192869701c015ffc87b15f..1555b5979d4fe379f0b9649cfaec653e520753bf 100644 --- a/src/OpenFOAM/primitives/contiguous/contiguous.H +++ b/src/OpenFOAM/primitives/contiguous/contiguous.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,6 +35,8 @@ Description #ifndef contiguous_H #define contiguous_H +#include <stdint.h> + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -70,67 +72,60 @@ template<> inline bool contiguous<Pair<char> >() {return true;} template<> -inline bool contiguous<unsigned char>() {return true;} -template<> -inline bool contiguous<FixedList<unsigned char, 2> >() {return true;} -template<> -inline bool contiguous<Pair<unsigned char> >() {return true;} - -template<> -inline bool contiguous<short>() {return true;} +inline bool contiguous<int8_t>() {return true;} template<> -inline bool contiguous<FixedList<short, 2> >() {return true;} +inline bool contiguous<FixedList<int8_t, 2> >() {return true;} template<> -inline bool contiguous<Pair<short> >() {return true;} +inline bool contiguous<Pair<int8_t> >() {return true;} template<> -inline bool contiguous<unsigned short>() {return true;} +inline bool contiguous<uint8_t>() {return true;} template<> -inline bool contiguous<FixedList<unsigned short, 2> >() {return true;} +inline bool contiguous<FixedList<uint8_t, 2> >() {return true;} template<> -inline bool contiguous<Pair<unsigned short> >() {return true;} +inline bool contiguous<Pair<uint8_t> >() {return true;} template<> -inline bool contiguous<int>() {return true;} +inline bool contiguous<int16_t>() {return true;} template<> -inline bool contiguous<FixedList<int, 2> >() {return true;} +inline bool contiguous<FixedList<int16_t, 2> >() {return true;} template<> -inline bool contiguous<Pair<int> >() {return true;} +inline bool contiguous<Pair<int16_t> >() {return true;} template<> -inline bool contiguous<unsigned int>() {return true;} +inline bool contiguous<uint16_t>() {return true;} template<> -inline bool contiguous<FixedList<unsigned int, 2> >() {return true;} +inline bool contiguous<FixedList<uint16_t, 2> >() {return true;} template<> -inline bool contiguous<Pair<unsigned int> >() {return true;} +inline bool contiguous<Pair<uint16_t> >() {return true;} template<> -inline bool contiguous<long>() {return true;} +inline bool contiguous<int32_t>() {return true;} template<> -inline bool contiguous<FixedList<long, 2> >() {return true;} +inline bool contiguous<FixedList<int32_t, 2> >() {return true;} template<> -inline bool contiguous<Pair<long> >() {return true;} +inline bool contiguous<Pair<int32_t> >() {return true;} template<> -inline bool contiguous<unsigned long>() {return true;} +inline bool contiguous<uint32_t>() {return true;} template<> -inline bool contiguous<FixedList<unsigned long, 2> >() {return true;} +inline bool contiguous<FixedList<uint32_t, 2> >() {return true;} template<> -inline bool contiguous<Pair<unsigned long> >() {return true;} +inline bool contiguous<Pair<uint32_t> >() {return true;} template<> -inline bool contiguous<long long>() {return true;} +inline bool contiguous<int64_t>() {return true;} template<> -inline bool contiguous<FixedList<long long, 2> >() {return true;} +inline bool contiguous<FixedList<int64_t, 2> >() {return true;} template<> -inline bool contiguous<Pair<long long> >() {return true;} +inline bool contiguous<Pair<int64_t> >() {return true;} template<> -inline bool contiguous<unsigned long long>() {return true;} +inline bool contiguous<uint64_t>() {return true;} template<> -inline bool contiguous<FixedList<unsigned long long, 2> >() {return true;} +inline bool contiguous<FixedList<uint64_t, 2> >() {return true;} template<> -inline bool contiguous<Pair<unsigned long long> >() {return true;} +inline bool contiguous<Pair<uint64_t> >() {return true;} template<> inline bool contiguous<float>() {return true;} diff --git a/src/OpenFOAM/primitives/ints/int/int.H b/src/OpenFOAM/primitives/ints/int/int.H index 9f3a34c978d696b89fbd1626c89bd7fb0fcd6a78..a3ab4b5ac1d226619b6524ef65663687aa3f75cf 100644 --- a/src/OpenFOAM/primitives/ints/int/int.H +++ b/src/OpenFOAM/primitives/ints/int/int.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,7 +28,6 @@ Description System integer SourceFiles - int.C intIO.C \*---------------------------------------------------------------------------*/ @@ -36,27 +35,40 @@ SourceFiles #ifndef int_H #define int_H -#include "word.H" +#include "int32.H" +#include "int64.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -class Istream; -class Ostream; +#define MAXMIN(retType, type1, type2) \ + \ +inline retType max(const type1 s1, const type2 s2) \ +{ \ + return (s1 > s2)? s1: s2; \ +} \ + \ +inline retType min(const type1 s1, const type2 s2) \ +{ \ + return (s1 < s2)? s1: s2; \ +} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//- Return a word representation of an int -word name(const int); +MAXMIN(int8_t, int8_t, int8_t) +MAXMIN(int16_t, int16_t, int16_t) + +MAXMIN(int32_t, int32_t, int32_t) +MAXMIN(int64_t, int64_t, int32_t) +MAXMIN(int64_t, int32_t, int64_t) +MAXMIN(int64_t, int64_t, int64_t) + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // int readInt(Istream&); -bool readInt(const char*, int&); -Istream& operator>>(Istream&, int&); -Ostream& operator<<(Ostream&, const int); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/ints/int/intIO.C b/src/OpenFOAM/primitives/ints/int/intIO.C index bd02519897de6e250c51ea77175392c5ddff3e62..9250e373136d82258a7d9c685f54b5ca63c466e8 100644 --- a/src/OpenFOAM/primitives/ints/int/intIO.C +++ b/src/OpenFOAM/primitives/ints/int/intIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,64 +21,13 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Reads an int from an input stream, for a given version - number and File format. If an ascii File is being read, - then the line numbers are counted and an erroneous read - ised. - \*---------------------------------------------------------------------------*/ -#include "error.H" - #include "int.H" #include "IOstreams.H" -#include <sstream> - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -Foam::word Foam::name(const int val) -{ - std::ostringstream buf; - buf << val; - return buf.str(); -} - - // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -Foam::Istream& Foam::operator>>(Istream& is, int& i) -{ - token t(is); - - if (!t.good()) - { - is.setBad(); - return is; - } - - if (t.isLabel()) - { - i = int(t.labelToken()); - } - else - { - is.setBad(); - FatalIOErrorIn("operator>>(Istream&, int&)", is) - << "wrong token type - expected int, found " << t.info() - << exit(FatalIOError); - - return is; - } - - // Check state of Istream - is.check("Istream& operator>>(Istream&, int&)"); - - return is; -} - - int Foam::readInt(Istream& is) { int val; @@ -88,21 +37,4 @@ int Foam::readInt(Istream& is) } -bool Foam::readInt(const char* buf, int& s) -{ - char *endptr = NULL; - long l = strtol(buf, &endptr, 10); - s = int(l); - return (*endptr == 0); -} - - -Foam::Ostream& Foam::operator<<(Ostream& os, const int i) -{ - os.write(label(i)); - os.check("Ostream& operator<<(Ostream&, const int)"); - return os; -} - - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/int32/int32.C b/src/OpenFOAM/primitives/ints/int32/int32.C new file mode 100644 index 0000000000000000000000000000000000000000..c3674a58f776314a86336046eb82bd79ad9cc2f9 --- /dev/null +++ b/src/OpenFOAM/primitives/ints/int32/int32.C @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "int32.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +const int32_t Foam::pTraits<int32_t>::zero = 0; +const int32_t Foam::pTraits<int32_t>::one = 1; +const int32_t Foam::pTraits<int32_t>::min = INT32_MIN; +const int32_t Foam::pTraits<int32_t>::max = INT32_MAX; +const int32_t Foam::pTraits<int32_t>::rootMin = pTraits<int32_t>::min; +const int32_t Foam::pTraits<int32_t>::rootMax = pTraits<int32_t>::max; + +const char* Foam::pTraits<int32_t>::componentNames[] = { "x" }; + +Foam::pTraits<int32_t>::pTraits(const int32_t& p) +: + p_(p) +{} + +Foam::pTraits<int32_t>::pTraits(Istream& is) +{ + is >> p_; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/int32/int32.H b/src/OpenFOAM/primitives/ints/int32/int32.H new file mode 100644 index 0000000000000000000000000000000000000000..4a36238ba27775d1cd6848470e198bf9a7d6d386 --- /dev/null +++ b/src/OpenFOAM/primitives/ints/int32/int32.H @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Primitive + int32 + +Description + 32bit integer + +SourceFiles + int32.C + int32IO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef int32_H +#define int32_H + +#include <stdint.h> +#include <climits> +#include <cstdlib> + +#include "word.H" +#include "pTraits.H" +#include "direction.H" + +#ifndef UINT32_MIN +#define UINT32_MIN 0 +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class Istream; +class Ostream; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Return a word representation of an int32 +word name(const int32_t); + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +int32_t readInt32(Istream&); +bool read(const char*, int32_t&); +Istream& operator>>(Istream&, int32_t&); +Ostream& operator<<(Ostream&, const int32_t); + +//- template specialization for pTraits<int32_t> +template<> +class pTraits<int32_t> +{ + int32_t p_; + +public: + + //- Component type + typedef int32_t cmptType; + + // Member constants + + enum + { + dim = 3, //!< Dimensionality of space + rank = 0, //!< Rank of int32_t is 0 + nComponents = 1 //!< Number of components in int32_t is 1 + }; + + + // Static data members + + static const char* const typeName; + static const char* componentNames[]; + static const int32_t zero; + static const int32_t one; + static const int32_t min; + static const int32_t max; + static const int32_t rootMax; + static const int32_t rootMin; + + + // Constructors + + //- Construct from primitive + explicit pTraits(const int32_t&); + + //- Construct from Istream + pTraits(Istream&); + + + // Member Functions + + //- Access to the int32_t value + operator int32_t() const + { + return p_; + } + + //- Access to the int value + operator int32_t&() + { + return p_; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/ulong/ulongIO.C b/src/OpenFOAM/primitives/ints/int32/int32IO.C similarity index 69% rename from src/OpenFOAM/primitives/ints/ulong/ulongIO.C rename to src/OpenFOAM/primitives/ints/int32/int32IO.C index a3e60971047e17ca6d63b553f2a2d624683753eb..209e9ae0d12c2108918877e6fbb79f361f6451e8 100644 --- a/src/OpenFOAM/primitives/ints/ulong/ulongIO.C +++ b/src/OpenFOAM/primitives/ints/int32/int32IO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,30 +21,28 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Reads a ulong from an input stream. - \*---------------------------------------------------------------------------*/ #include "error.H" -#include "ulong.H" +#include "int32.H" #include "IOstreams.H" #include <sstream> // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Foam::word Foam::name(const unsigned long val) +Foam::word Foam::name(const int32_t val) { std::ostringstream buf; buf << val; return buf.str(); } + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -Foam::Istream& Foam::operator>>(Istream& is, unsigned long& val) +Foam::Istream& Foam::operator>>(Istream& is, int32_t& i) { token t(is); @@ -56,38 +54,47 @@ Foam::Istream& Foam::operator>>(Istream& is, unsigned long& val) if (t.isLabel()) { - val = static_cast<unsigned long>(t.labelToken()); + i = int32_t(t.labelToken()); } else { is.setBad(); - FatalIOErrorIn("operator>>(Istream&, unsigned long&)", is) - << "wrong token type - expected unsigned long, found " << t.info() + FatalIOErrorIn("operator>>(Istream&, int32_t&)", is) + << "wrong token type - expected int32_t, found " << t.info() << exit(FatalIOError); return is; } // Check state of Istream - is.check("Istream& operator>>(Istream&, unsigned long&)"); + is.check("Istream& operator>>(Istream&, int32_t&)"); return is; } -unsigned long Foam::readUlong(Istream& is) +int32_t Foam::readInt32(Istream& is) { - unsigned long val; + int32_t val; is >> val; return val; } -Foam::Ostream& Foam::operator<<(Ostream& os, const unsigned long val) +bool Foam::read(const char* buf, int32_t& s) +{ + char *endptr = NULL; + long l = strtol(buf, &endptr, 10); + s = int32_t(l); + return (*endptr == 0); +} + + +Foam::Ostream& Foam::operator<<(Ostream& os, const int32_t i) { - os.write(label(val)); - os.check("Ostream& operator<<(Ostream&, const unsigned long)"); + os.write(label(i)); + os.check("Ostream& operator<<(Ostream&, const int32_t)"); return os; } diff --git a/src/OpenFOAM/primitives/ints/int64/int64.C b/src/OpenFOAM/primitives/ints/int64/int64.C new file mode 100644 index 0000000000000000000000000000000000000000..351eff9de243a48e1df3076f9e9065463af07d9b --- /dev/null +++ b/src/OpenFOAM/primitives/ints/int64/int64.C @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "int64.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +const int64_t Foam::pTraits<int64_t>::zero = 0; +const int64_t Foam::pTraits<int64_t>::one = 1; +const int64_t Foam::pTraits<int64_t>::min = INT64_MIN; +const int64_t Foam::pTraits<int64_t>::max = INT64_MAX; +const int64_t Foam::pTraits<int64_t>::rootMin = pTraits<int64_t>::min; +const int64_t Foam::pTraits<int64_t>::rootMax = pTraits<int64_t>::max; + +const char* Foam::pTraits<int64_t>::componentNames[] = { "x" }; + +Foam::pTraits<int64_t>::pTraits(const int64_t& p) +: + p_(p) +{} + +Foam::pTraits<int64_t>::pTraits(Istream& is) +{ + is >> p_; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/int64/int64.H b/src/OpenFOAM/primitives/ints/int64/int64.H new file mode 100644 index 0000000000000000000000000000000000000000..757a6d62fe54ea072afdef040905f0ac4f2a58fd --- /dev/null +++ b/src/OpenFOAM/primitives/ints/int64/int64.H @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Primitive + int64 + +Description + 64bit integer + +SourceFiles + int64.C + int64IO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef int64_H +#define int64_H + +#include <stdint.h> +#include <climits> +#include <cstdlib> + +#include "word.H" +#include "pTraits.H" +#include "direction.H" + +#ifndef UINT64_MIN +#define UINT64_MIN 0 +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class Istream; +class Ostream; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Return a word representation of an int64 +word name(const int64_t); + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +int64_t readInt64(Istream&); +bool read(const char*, int64_t&); +Istream& operator>>(Istream&, int64_t&); +Ostream& operator<<(Ostream&, const int64_t); + +//- template specialization for pTraits<int64_t> +template<> +class pTraits<int64_t> +{ + int64_t p_; + +public: + + //- Component type + typedef int64_t cmptType; + + // Member constants + + enum + { + dim = 3, //!< Dimensionality of space + rank = 0, //!< Rank of int64_t is 0 + nComponents = 1 //!< Number of components in int64_t is 1 + }; + + + // Static data members + + static const char* const typeName; + static const char* componentNames[]; + static const int64_t zero; + static const int64_t one; + static const int64_t min; + static const int64_t max; + static const int64_t rootMax; + static const int64_t rootMin; + + + // Constructors + + //- Construct from primitive + explicit pTraits(const int64_t&); + + //- Construct from Istream + pTraits(Istream&); + + + // Member Functions + + //- Access to the int64_t value + operator int64_t() const + { + return p_; + } + + //- Access to the int value + operator int64_t&() + { + return p_; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/long/longIO.C b/src/OpenFOAM/primitives/ints/int64/int64IO.C similarity index 68% rename from src/OpenFOAM/primitives/ints/long/longIO.C rename to src/OpenFOAM/primitives/ints/int64/int64IO.C index 7e352bd9db3d06196c230a7badd25ace281a3c7c..84bd2a045b2919fa001364460c4dfd3c2bf0797c 100644 --- a/src/OpenFOAM/primitives/ints/long/longIO.C +++ b/src/OpenFOAM/primitives/ints/int64/int64IO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,32 +21,28 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Reads a long from an input stream, for a given version - number and File format. If an ascii File is being read, then the line - numbers are counted and an erroneous read ised. - \*---------------------------------------------------------------------------*/ #include "error.H" -#include "long.H" +#include "int64.H" #include "IOstreams.H" #include <sstream> // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Foam::word Foam::name(const long val) +Foam::word Foam::name(const int64_t val) { std::ostringstream buf; buf << val; return buf.str(); } + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -Foam::Istream& Foam::operator>>(Istream& is, long& l) +Foam::Istream& Foam::operator>>(Istream& is, int64_t& i) { token t(is); @@ -58,45 +54,47 @@ Foam::Istream& Foam::operator>>(Istream& is, long& l) if (t.isLabel()) { - l = long(t.labelToken()); + i = int64_t(t.labelToken()); } else { is.setBad(); - FatalIOErrorIn("operator>>(Istream&, long&)", is) - << "wrong token type - expected long, found " << t.info() + FatalIOErrorIn("operator>>(Istream&, int64_t&)", is) + << "wrong token type - expected int64_t, found " << t.info() << exit(FatalIOError); return is; } // Check state of Istream - is.check("Istream& operator>>(Istream&, long&)"); + is.check("Istream& operator>>(Istream&, int64_t&)"); return is; } -long Foam::readLong(Istream& is) +int64_t Foam::readInt64(Istream& is) { - long val; + int64_t val; is >> val; return val; } -bool Foam::readLong(const char* buf, long& s) + +bool Foam::read(const char* buf, int64_t& s) { char *endptr = NULL; - s = strtol(buf, &endptr, 10); + long l = strtol(buf, &endptr, 10); + s = int64_t(l); return (*endptr == 0); } -Foam::Ostream& Foam::operator<<(Ostream& os, const long l) +Foam::Ostream& Foam::operator<<(Ostream& os, const int64_t i) { - os.write(label(l)); - os.check("Ostream& operator<<(Ostream&, const long)"); + os.write(label(i)); + os.check("Ostream& operator<<(Ostream&, const int64_t)"); return os; } diff --git a/src/OpenFOAM/primitives/ints/label/label.C b/src/OpenFOAM/primitives/ints/label/label.C index d0129af7da203779564af86c4a34e5f92d8803fe..b09c3fa5e6a248505856038db868068313ee6497 100644 --- a/src/OpenFOAM/primitives/ints/label/label.C +++ b/src/OpenFOAM/primitives/ints/label/label.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,63 +28,18 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -const char* const pTraits<label>::typeName = "label"; -const label pTraits<label>::zero = 0; -const label pTraits<label>::one = 1; -const label pTraits<label>::min = labelMin; -const label pTraits<label>::max = labelMax; -const label pTraits<label>::rootMin = pTraits<label>::min; -const label pTraits<label>::rootMax = pTraits<label>::max; - -const char* pTraits<label>::componentNames[] = { "x" }; - -pTraits<label>::pTraits(const label& p) -: - p_(p) -{} - - -pTraits<label>::pTraits(Istream& is) -{ - is >> p_; -} - - -#if (FOAM_LABEL_MAX != INT_MAX) -const char* const pTraits<int>::typeName = "int"; -const int pTraits<int>::zero = 0; -const int pTraits<int>::one = 1; -const int pTraits<int>::min = INT_MIN; -const int pTraits<int>::max = INT_MAX; -const int pTraits<int>::min = INT_MIN; -const int pTraits<int>::max = INT_MAX; -const int pTraits<int>::rootMin = pTraits<int>::min; -const int pTraits<int>::rootMax = pTraits<int>::max; - -const char* pTraits<int>::componentNames[] = { "x" }; - -pTraits<int>::pTraits(const int& p) -: - p_(p) -{} - - -pTraits<int>::pTraits(Istream& is) -{ - is >> p_; -} +#if WM_LABEL_SIZE == 32 +const char* const Foam::pTraits<int64_t>::typeName = "int64"; +const char* const Foam::pTraits<int32_t>::typeName = "label"; +#elif WM_LABEL_SIZE == 64 +const char* const Foam::pTraits<int64_t>::typeName = "label"; +const char* const Foam::pTraits<int32_t>::typeName = "int32"; #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Raise one label to the power of another (overloaded function call) -label pow(label a, label b) +Foam::label Foam::pow(label a, label b) { register label ans = 1; for (register label i=0; i<b; i++) @@ -92,21 +47,20 @@ label pow(label a, label b) ans *= a; } -# ifdef FULLDEBUG + #ifdef FULLDEBUG if (b < 0) { FatalErrorIn("pow(label a, label b)") << "negative value for b is not supported" << abort(FatalError); } -# endif + #endif return ans; } -//- Return factorial(n) : 0 <= n <= 12 -label factorial(label n) +Foam::label Foam::factorial(label n) { static label factTable[13] = { @@ -114,21 +68,17 @@ label factorial(label n) 362880, 3628800, 39916800, 479001600 }; -# ifdef FULLDEBUG + #ifdef FULLDEBUG if (n > 12 && n < 0) { FatalErrorIn("factorial(label n)") << "n value out of range" << abort(FatalError); } -# endif + #endif return factTable[n]; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/label/label.H b/src/OpenFOAM/primitives/ints/label/label.H index ed0160a108685cccbd1efad9f331fdbea98f4877..846803d08166a6329cbf40355511e4072cfc403e 100644 --- a/src/OpenFOAM/primitives/ints/label/label.H +++ b/src/OpenFOAM/primitives/ints/label/label.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,8 @@ Typedef Foam::label Description - A label is an int/long/long long depending on the range desired. + A label is an int32_t or int64_t as specified by the pre-processor macro + WM_LABEL_SIZE. A readLabel function is defined so that label can be constructed from Istream. @@ -35,239 +36,35 @@ Description #ifndef label_H #define label_H -#include <climits> -#include <cstdlib> +#include "int.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#define INT_ADD_SIZE(x,s,y) x ## s ## y +#define INT_ADD_DEF_SIZE(x,s,y) INT_ADD_SIZE(x,s,y) +#define INT_SIZE(x,y) INT_ADD_DEF_SIZE(x,WM_LABEL_SIZE,y) -#if FOAM_LABEL64 -# define FOAM_LABEL_MAX 9000000000000000000 -#else -# define FOAM_LABEL_MAX 2000000000 -#endif - -#include "pTraits.H" -#include "direction.H" - - -#if INT_MAX > FOAM_LABEL_MAX - -// Define label as an int - -# undef FOAM_LABEL_MAX -# define FOAM_LABEL_MAX INT_MAX - -# include "int.H" - -namespace Foam -{ - typedef int label; - - static const label labelMin = INT_MIN; - static const label labelMax = INT_MAX; - - inline label readLabel(Istream& is) - { - return readInt(is); - } - - inline bool readLabel(const char* buf, label& s) - { - return readInt(buf, s); - } - -} // End namespace Foam - - -#elif LONG_MAX > FOAM_LABEL_MAX -// Define label as a long - -# undef FOAM_LABEL_MAX -# define FOAM_LABEL_MAX LONG_MAX - -# include "int.H" -# include "long.H" - -namespace Foam -{ - typedef long label; - - static const label labelMin = LONG_MIN; - static const label labelMax = LONG_MAX; - - inline label readLabel(Istream& is) - { - return readLong(is); - } - - inline bool readLabel(const char* buf, label& s) - { - return readLong(buf, s); - } - -} // End namespace Foam - - -#elif LLONG_MAX > FOAM_LABEL_MAX - -// Define label as a long long - -# undef FOAM_LABEL_MAX -# define FOAM_LABEL_MAX LLONG_MAX - -# include "int.H" -# include "long.H" -# include "longLong.H" - -namespace Foam -{ - typedef long long label; - - static const label labelMin = LLONG_MIN; - static const label labelMax = LLONG_MAX; - - inline label readLabel(Istream& is) - { - return readLongLong(is); - } - - inline bool readLabel(const char* buf, label& s) - { - return readLongLong(buf, s); - } - -} // End namespace Foam - +#if WM_LABEL_SIZE != 32 && WM_LABEL_SIZE != 64 + #error "label.H: WM_LABEL_SIZE must be set to either 32 or 64" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//#include "pTraits.H" -//#include "direction.H" - namespace Foam { -//- template specialization for pTraits<label> -template<> -class pTraits<label> -{ - label p_; - -public: - - //- Component type - typedef label cmptType; - - // Member constants - - enum - { - dim = 3, //!< Dimensionality of space - rank = 0, //!< Rank of label is 0 - nComponents = 1 //!< Number of components in label is 1 - }; - - - // Static data members - - static const char* const typeName; - static const char* componentNames[]; - static const label zero; - static const label one; - static const label min; - static const label max; - static const label rootMin; - static const label rootMax; - - - // Constructors - - //- Construct from primitive - explicit pTraits(const label&); - - //- Construct from Istream - pTraits(Istream&); - - - // Member Functions - - //- Access to the label value - operator label() const - { - return p_; - } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - //- Access to the label value - operator label&() - { - return p_; - } -}; +typedef INT_SIZE(int, _t) label; +static const label labelMin = INT_SIZE(INT, _MIN); +static const label labelMax = INT_SIZE(INT, _MAX); -// For convenience's sake always define pTraits<int> (so even if label != int) -#if (FOAM_LABEL_MAX != INT_MAX) -//- template specialization for pTraits<int> -template<> -class pTraits<int> +inline label readLabel(Istream& is) { - int p_; - -public: - - //- Component type - typedef int cmptType; - - // Member constants - - enum - { - dim = 3, //!< Dimensionality of space - rank = 0, //!< Rank of int is 0 - nComponents = 1 //!< Number of components in int is 1 - }; - - - // Static data members - - static const char* const typeName; - static const char* componentNames[]; - static const int zero; - static const int one; - static const int min; - static const int max; - static const int rootMax; - static const int rootMin; - - - // Constructors - - //- Construct from primitive - explicit pTraits(const int&); - - //- Construct from Istream - pTraits(Istream&); - - - // Member Functions - - //- Access to the int value - operator int() const - { - return p_; - } - - //- Access to the int value - operator int&() - { - return p_; - } -}; -#endif - + return INT_SIZE(readInt,) (is); +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -275,40 +72,10 @@ public: //- Raise one label to the power of another label pow(label a, label b); -//- Evaluate n! : n <= 12 +//- Evaluate n! : 0 < n <= 12 label factorial(label n); -#define MAXMIN(retType, type1, type2) \ - \ -inline retType max(const type1 s1, const type2 s2) \ -{ \ - return (s1 > s2)? s1: s2; \ -} \ - \ -inline retType min(const type1 s1, const type2 s2) \ -{ \ - return (s1 < s2)? s1: s2; \ -} - - -MAXMIN(char, char, char) -MAXMIN(short, short, short) -MAXMIN(int, int, int) -MAXMIN(long, long, long) -MAXMIN(long, long, int) -MAXMIN(long long, long long, long long) - -MAXMIN(unsigned char, unsigned char, unsigned char) -MAXMIN(unsigned short, unsigned short, unsigned short) -MAXMIN(unsigned int, unsigned int, unsigned int) -MAXMIN(unsigned long, unsigned long, unsigned long) -MAXMIN(unsigned long long, unsigned long long, unsigned long long) - -MAXMIN(long, int, long) -MAXMIN(long long, int, long long) -MAXMIN(long long, long long, int) - inline label& setComponent(label& l, const direction) { return l; @@ -319,33 +86,18 @@ inline label component(const label l, const direction) return l; } -inline label mag(const label l) -{ - return ::abs(l); -} - -inline label sign(const label s) -{ - return (s >= 0)? 1: -1; -} - -inline label pos(const label s) -{ - return (s >= 0)? 1: 0; -} - -inline label neg(const label s) -{ - return (s < 0)? 1: 0; -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "labelSpecific.H" + +#undef INT_ADD_SIZE +#undef INT_ADD_DEF_SIZE +#undef INT_SIZE + #endif // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/long/long.H b/src/OpenFOAM/primitives/ints/label/labelSpecific.H similarity index 71% rename from src/OpenFOAM/primitives/ints/long/long.H rename to src/OpenFOAM/primitives/ints/label/labelSpecific.H index 6e09fc2046be520ebef6851572d13fff47bb8678..f6b9fd5dd9093630bfec25406de1fcdc3fc777bf 100644 --- a/src/OpenFOAM/primitives/ints/long/long.H +++ b/src/OpenFOAM/primitives/ints/label/labelSpecific.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,48 +21,47 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Primitive - long +Typedef + Foam::label Description - A long integer - -SourceFiles - longIO.C + label specific functions for which there is no uLabel equivalent \*---------------------------------------------------------------------------*/ -#ifndef long_H -#define long_H - -#include "word.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -class Istream; -class Ostream; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//- Return a string representation of a long -word name(const long); +inline label mag(const label l) +{ + #if WM_LABEL_SIZE == 32 + return ::abs(l); + #elif WM_LABEL_SIZE == 64 + return ::labs(l); + #endif +} + +inline label sign(const label s) +{ + return (s >= 0)? 1: -1; +} -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // +inline label pos(const label s) +{ + return (s >= 0)? 1: 0; +} -long readLong(Istream&); -bool readLong(const char*, long&); -Istream& operator>>(Istream&, long&); -Ostream& operator<<(Ostream&, const long); +inline label neg(const label s) +{ + return (s < 0)? 1: 0; +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/longLong/longLongIO.C b/src/OpenFOAM/primitives/ints/longLong/longLongIO.C deleted file mode 100644 index 384fe1bf1f056f584a1b4d545edb10b08bc3c262..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/primitives/ints/longLong/longLongIO.C +++ /dev/null @@ -1,131 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Description - Reads a long long from an input stream, for a given version - number and File format. If an ascii File is being read, then the line - numbers are counted and an erroneous read ised. - -\*---------------------------------------------------------------------------*/ - -#include "error.H" - -#include "longLong.H" -#include "IOstreams.H" - -#include <sstream> - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -Foam::word Foam::name(long long val) -{ - std::ostringstream buf; - buf << val; - return buf.str(); -} - -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // - -Foam::Istream& Foam::operator>>(Istream& is, long long& l) -{ - l = readLongLong(is); - - // Check state of Istream - is.check("Istream& operator>>(Istream&, long long&)"); - - return is; -} - - -long long Foam::readLongLong(Istream& is) -{ - register long long result = 0; - - char c = 0; - - static const label zeroOffset = int('0'); - - // Get next non-whitespace character - while (is.read(c) && isspace(c)) - {} - - do - { - if (isspace(c) || c == 0) break; - - if (!isdigit(c)) - { - FatalIOErrorIn("readLongLong(ISstream& is)", is) - << "Illegal digit: \"" << c << "\"" - << exit(FatalIOError); - } - - result *= 10 + int(c) - zeroOffset; - } while (is.read(c)); - - return result; -} - - -bool Foam::readLongLong(const char* buf, long long& s) -{ - char *endptr = NULL; - s = strtoll(buf, &endptr, 10); - return (*endptr == 0); -} - - -Foam::Ostream& Foam::operator<<(Ostream& os, const long long l) -{ - long long val = l; - - long long mask = 1000000000000000000LL; - - bool printZeroes = false; - - while (mask > 0) - { - int d = int(val/mask); - - if (d == 0) - { - if (printZeroes) - { - os.write('0'); - } - } - else - { - printZeroes = true; - os.write(char(d+'0')); - } - - val = val % mask; - mask /= 10; - } - os.check("Ostream& operator<<(Ostream&, const long long)"); - return os; -} - - -// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/uLabel/uLabel.C b/src/OpenFOAM/primitives/ints/uLabel/uLabel.C index 2e8f4889833730f7108051000768e8813f0c1088..3fb842e7f1aeaff552514b6657a3dcffcf65a66b 100644 --- a/src/OpenFOAM/primitives/ints/uLabel/uLabel.C +++ b/src/OpenFOAM/primitives/ints/uLabel/uLabel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,40 +23,62 @@ License \*---------------------------------------------------------------------------*/ -#include "uLabel.H" #include "error.H" +#include "uLabel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -const char* const pTraits<uLabel>::typeName = "uLabel"; -const uLabel pTraits<uLabel>::zero = 0; -const uLabel pTraits<uLabel>::one = 1; -const uLabel pTraits<uLabel>::min = uLabelMin; -const uLabel pTraits<uLabel>::max = uLabelMax; -const uLabel pTraits<uLabel>::rootMin = pTraits<uLabel>::min; -const uLabel pTraits<uLabel>::rootMax = pTraits<uLabel>::max; +#if WM_LABEL_SIZE == 32 +const char* const Foam::pTraits<uint64_t>::typeName = "uint64"; +const char* const Foam::pTraits<uint32_t>::typeName = "uLabel"; +#elif WM_LABEL_SIZE == 64 +const char* const Foam::pTraits<uint64_t>::typeName = "uLabel"; +const char* const Foam::pTraits<uint32_t>::typeName = "uint32"; +#endif -const char* pTraits<uLabel>::componentNames[] = { "x" }; - -pTraits<uLabel>::pTraits(const uLabel& p) -: - p_(p) -{} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -pTraits<uLabel>::pTraits(Istream& is) +Foam::uLabel Foam::pow(uLabel a, uLabel b) { - is >> p_; + register uLabel ans = 1; + for (register uLabel i=0; i<b; i++) + { + ans *= a; + } + + #ifdef FULLDEBUG + if (b < 0) + { + FatalErrorIn("pow(uLabel a, uLabel b)") + << "negative value for b is not supported" + << abort(FatalError); + } + #endif + + return ans; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +Foam::uLabel Foam::factorial(uLabel n) +{ + static uLabel factTable[13] = + { + 1, 1, 2, 6, 24, 120, 720, 5040, 40320, + 362880, 3628800, 39916800, 479001600 + }; + + #ifdef FULLDEBUG + if (n > 12 && n < 0) + { + FatalErrorIn("factorial(uLabel n)") + << "n value out of range" + << abort(FatalError); + } + #endif + + return factTable[n]; +} -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/uLabel/uLabel.H b/src/OpenFOAM/primitives/ints/uLabel/uLabel.H index d8a985f39ee5b5ba7aafaf2b858e4d6e83519be4..27443560bf6d17ff8c6030bac5a28b88594dc5ba 100644 --- a/src/OpenFOAM/primitives/ints/uLabel/uLabel.H +++ b/src/OpenFOAM/primitives/ints/uLabel/uLabel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,156 +25,56 @@ Typedef Foam::uLabel Description - A uLabel is an unsigned label. + A uLabel is an uint32_t or uint64_t as specified by the pre-processor macro + WM_LABEL_SIZE. -SeeAlso - label.H + A readLabel function is defined so that uLabel can be constructed from + Istream. \*---------------------------------------------------------------------------*/ #ifndef uLabel_H #define uLabel_H -#include <climits> -#include <cstdlib> +#include "uint.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#define UINT_ADD_SIZE(x,s,y) x ## s ## y +#define UINT_ADD_DEF_SIZE(x,s,y) UINT_ADD_SIZE(x,s,y) +#define UINT_SIZE(x,y) UINT_ADD_DEF_SIZE(x,WM_LABEL_SIZE,y) -#if FOAM_LABEL64 -# define FOAM_ULABEL_MAX 18000000000000000000u -#else -# define FOAM_ULABEL_MAX 4000000000u +#if WM_LABEL_SIZE != 32 && WM_LABEL_SIZE != 64 + #error "uLabel.H: WM_LABEL_SIZE must be set to either 32 or 64" #endif -#if UINT_MAX > FOAM_ULABEL_MAX - -// Define uLabel as an unsigned int - -# undef FOAM_ULABEL_MAX -# define FOAM_ULABEL_MAX UINT_MAX - -# include "uint.H" - -namespace Foam -{ - typedef unsigned int uLabel; - - static const uLabel uLabelMin = 0; - static const uLabel uLabelMax = UINT_MAX; - - inline uLabel readULabel(Istream& is) - { - return readUint(is); - } - -} // End namespace Foam - - -#elif ULONG_MAX > FOAM_ULABEL_MAX - -// Define uLabel as an unsigned long - -# undef FOAM_ULABEL_MAX -# define FOAM_ULABEL_MAX ULONG_MAX - -# include "uint.H" -# include "ulong.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - typedef unsigned long uLabel; - - static const uLabel uLabelMin = 0; - static const uLabel uLabelMax = ULONG_MAX; - - inline uLabel readULabel(Istream& is) - { - return readUlong(is); - } - -} // End namespace Foam - - -#elif ULLONG_MAX > FOAM_ULABEL_MAX - -// Define uLabel as an unsigned long long - -# undef FOAM_ULABEL_MAX - -# error "Not implemented yet" - -#endif - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "pTraits.H" -#include "direction.H" +typedef UINT_SIZE(uint, _t) uLabel; -namespace Foam -{ +static const uLabel uLabelMin = UINT_SIZE(UINT, _MIN); +static const uLabel uLabelMax = UINT_SIZE(UINT, _MAX); -//- template specialization for pTraits<uLabel> -template<> -class pTraits<uLabel> +inline uLabel readULabel(Istream& is) { - uLabel p_; - -public: - - //- Component type - typedef uLabel cmptType; - - // Member constants - - enum - { - dim = 3, //!< Dimensionality of space - rank = 0, //!< Rank of uLabel is 0 - nComponents = 1 //!< Number of components in uLabel is 1 - }; - - - // Static data members - - static const char* const typeName; - static const char* componentNames[]; - static const uLabel zero; - static const uLabel one; - static const uLabel max; - static const uLabel min; - static const uLabel rootMax; - static const uLabel rootMin; - - - // Constructors - - //- Construct from primitive - explicit pTraits(const uLabel&); - - //- Construct from Istream - pTraits(Istream&); - + return UINT_SIZE(readUint,) (is); +} - // Member Functions - //- Access to the uLabel value - operator uLabel() const - { - return p_; - } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - //- Access to the uLabel value - operator uLabel&() - { - return p_; - } -}; +//- Raise one uLabel to the power of another +uLabel pow(uLabel a, uLabel b); +//- Evaluate n! : 0 < n <= 12 +uLabel factorial(uLabel n); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // inline uLabel& setComponent(uLabel& l, const direction) { @@ -186,13 +86,18 @@ inline uLabel component(const uLabel l, const direction) return l; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "uLabelSpecific.H" + +#undef UINT_ADD_SIZE +#undef UINT_ADD_DEF_SIZE +#undef UINT_SIZE + #endif // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/uLabel/uLabelSpecific.H b/src/OpenFOAM/primitives/ints/uLabel/uLabelSpecific.H new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/OpenFOAM/primitives/ints/uint/uint.H b/src/OpenFOAM/primitives/ints/uint/uint.H index bbac95c5907f6bf825128733111a5e2d3a5895c4..0aa847e7fbe42294b7498e7e8f945ed7e0b0bfe0 100644 --- a/src/OpenFOAM/primitives/ints/uint/uint.H +++ b/src/OpenFOAM/primitives/ints/uint/uint.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Primitive uint Description - System unsigned integer + System uinteger SourceFiles uintIO.C @@ -35,26 +35,40 @@ SourceFiles #ifndef uint_H #define uint_H -#include "word.H" +#include "uint32.H" +#include "uint64.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -class Istream; -class Ostream; +#define MAXMIN(retType, type1, type2) \ + \ +inline retType max(const type1 s1, const type2 s2) \ +{ \ + return (s1 > s2)? s1: s2; \ +} \ + \ +inline retType min(const type1 s1, const type2 s2) \ +{ \ + return (s1 < s2)? s1: s2; \ +} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//- Return a string representation of an uint -word name(const unsigned int); +MAXMIN(uint8_t, uint8_t, uint8_t) +MAXMIN(uint16_t, uint16_t, uint16_t) + +MAXMIN(uint32_t, uint32_t, uint32_t) +MAXMIN(uint64_t, uint64_t, uint32_t) +MAXMIN(uint64_t, uint32_t, uint64_t) +MAXMIN(uint64_t, uint64_t, uint64_t) + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -unsigned int readUint(Istream&); -Istream& operator>>(Istream&, unsigned int&); -Ostream& operator<<(Ostream&, const unsigned int); +uint readUint(Istream&); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/ints/uint/uintIO.C b/src/OpenFOAM/primitives/ints/uint/uintIO.C index eaead2aa0895a7cff91a7e510cf4ec32edf4e9d7..859eb1f8f60a058b6e178fc2be9303558851e7ab 100644 --- a/src/OpenFOAM/primitives/ints/uint/uintIO.C +++ b/src/OpenFOAM/primitives/ints/uint/uintIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,78 +21,20 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Reads an uint from an input stream, for a given version - number and File format. If an ascii File is being read, - then the line numbers are counted and an erroneous read - ised. - \*---------------------------------------------------------------------------*/ -#include "error.H" - #include "uint.H" #include "IOstreams.H" -#include <sstream> - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -Foam::word Foam::name(const unsigned int val) -{ - std::ostringstream buf; - buf << val; - return buf.str(); -} - // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -Foam::Istream& Foam::operator>>(Istream& is, unsigned int& i) -{ - token t(is); - - if (!t.good()) - { - is.setBad(); - return is; - } - - if (t.isLabel()) - { - i = static_cast<unsigned int>(t.labelToken()); - } - else - { - is.setBad(); - FatalIOErrorIn("operator>>(Istream&, unsigned int&)", is) - << "wrong token type - expected unsigned int, found " << t.info() - << exit(FatalIOError); - - return is; - } - - // Check state of Istream - is.check("Istream& operator>>(Istream&, unsigned int&)"); - - return is; -} - - -unsigned int Foam::readUint(Istream& is) +uint Foam::readUint(Istream& is) { - unsigned int val; + uint val; is >> val; return val; } -Foam::Ostream& Foam::operator<<(Ostream& os, const unsigned int i) -{ - os.write(label(i)); - os.check("Ostream& operator<<(Ostream&, const unsigned int)"); - return os; -} - - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/ulong/ulong.H b/src/OpenFOAM/primitives/ints/uint32/uint32.C similarity index 60% rename from src/OpenFOAM/primitives/ints/ulong/ulong.H rename to src/OpenFOAM/primitives/ints/uint32/uint32.C index ba83c544732810cb07e603a57eff03ffc7023dee..cdafc334413f0a06c4e25872500763e2b3a60276 100644 --- a/src/OpenFOAM/primitives/ints/ulong/ulong.H +++ b/src/OpenFOAM/primitives/ints/uint32/uint32.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,47 +21,30 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Primitive - ulong - -Description - System unsigned long - -SourceFiles - ulongIO.C - \*---------------------------------------------------------------------------*/ -#ifndef ulong_H -#define ulong_H - -#include "word.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -class Istream; -class Ostream; +#include "uint32.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//- Return a string representation of a ulong -word name(const unsigned long); +const uint32_t Foam::pTraits<uint32_t>::zero = 0; +const uint32_t Foam::pTraits<uint32_t>::one = 1; +const uint32_t Foam::pTraits<uint32_t>::min = INT32_MIN; +const uint32_t Foam::pTraits<uint32_t>::max = INT32_MAX; +const uint32_t Foam::pTraits<uint32_t>::rootMin = pTraits<uint32_t>::min; +const uint32_t Foam::pTraits<uint32_t>::rootMax = pTraits<uint32_t>::max; -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // +const char* Foam::pTraits<uint32_t>::componentNames[] = { "x" }; -unsigned long readUlong(Istream&); -Istream& operator>>(Istream&, unsigned long&); -Ostream& operator<<(Ostream&, const unsigned long); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +Foam::pTraits<uint32_t>::pTraits(const uint32_t& p) +: + p_(p) +{} -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +Foam::pTraits<uint32_t>::pTraits(Istream& is) +{ + is >> p_; +} -#endif // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/uint32/uint32.H b/src/OpenFOAM/primitives/ints/uint32/uint32.H new file mode 100644 index 0000000000000000000000000000000000000000..71ad73897b8c75ef53afe1f7ffd7300e012031cf --- /dev/null +++ b/src/OpenFOAM/primitives/ints/uint32/uint32.H @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Primitive + uint32 + +Description + 32bit uinteger + +SourceFiles + uint32.C + uint32IO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef uint32_H +#define uint32_H + +#include <stdint.h> +#include <climits> +#include <cstdlib> + +#include "word.H" +#include "pTraits.H" +#include "direction.H" + +#ifndef UINT32_MIN +#define UINT32_MIN 0 +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class Istream; +class Ostream; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Return a word representation of an uint32 +word name(const uint32_t); + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +uint32_t readUint32(Istream&); +bool read(const char*, uint32_t&); +Istream& operator>>(Istream&, uint32_t&); +Ostream& operator<<(Ostream&, const uint32_t); + +//- template specialization for pTraits<uint32_t> +template<> +class pTraits<uint32_t> +{ + uint32_t p_; + +public: + + //- Component type + typedef uint32_t cmptType; + + // Member constants + + enum + { + dim = 3, //!< Dimensionality of space + rank = 0, //!< Rank of uint32_t is 0 + nComponents = 1 //!< Number of components in uint32_t is 1 + }; + + + // Static data members + + static const char* const typeName; + static const char* componentNames[]; + static const uint32_t zero; + static const uint32_t one; + static const uint32_t min; + static const uint32_t max; + static const uint32_t rootMax; + static const uint32_t rootMin; + + + // Constructors + + //- Construct from primitive + explicit pTraits(const uint32_t&); + + //- Construct from Istream + pTraits(Istream&); + + + // Member Functions + + //- Access to the uint32_t value + operator uint32_t() const + { + return p_; + } + + //- Access to the uint value + operator uint32_t&() + { + return p_; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/uint32/uint32IO.C b/src/OpenFOAM/primitives/ints/uint32/uint32IO.C new file mode 100644 index 0000000000000000000000000000000000000000..688834e7371b4a4675c2b2c71c27ac305b5840aa --- /dev/null +++ b/src/OpenFOAM/primitives/ints/uint32/uint32IO.C @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "error.H" + +#include "uint32.H" +#include "IOstreams.H" + +#include <sstream> + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::word Foam::name(const uint32_t val) +{ + std::ostringstream buf; + buf << val; + return buf.str(); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>>(Istream& is, uint32_t& i) +{ + token t(is); + + if (!t.good()) + { + is.setBad(); + return is; + } + + if (t.isLabel()) + { + i = uint32_t(t.labelToken()); + } + else + { + is.setBad(); + FatalIOErrorIn("operator>>(Istream&, uint32_t&)", is) + << "wrong token type - expected uint32_t, found " << t.info() + << exit(FatalIOError); + + return is; + } + + // Check state of Istream + is.check("Istream& operator>>(Istream&, uint32_t&)"); + + return is; +} + + +uint32_t Foam::readUint32(Istream& is) +{ + uint32_t val; + is >> val; + + return val; +} + + +bool Foam::read(const char* buf, uint32_t& s) +{ + char *endptr = NULL; + long l = strtol(buf, &endptr, 10); + s = uint32_t(l); + return (*endptr == 0); +} + + +Foam::Ostream& Foam::operator<<(Ostream& os, const uint32_t i) +{ + os.write(label(i)); + os.check("Ostream& operator<<(Ostream&, const uint32_t)"); + return os; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/longLong/longLong.H b/src/OpenFOAM/primitives/ints/uint64/uint64.C similarity index 58% rename from src/OpenFOAM/primitives/ints/longLong/longLong.H rename to src/OpenFOAM/primitives/ints/uint64/uint64.C index e1595e8462d80d6a9e7d09caaa0d19c3c012575d..bbe35d20bb8a830a685ea46413113f4a446351bc 100644 --- a/src/OpenFOAM/primitives/ints/longLong/longLong.H +++ b/src/OpenFOAM/primitives/ints/uint64/uint64.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,48 +21,30 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Primitive - long long - -Description - A long long (64 bits on many systems) - -SourceFiles - longLongIO.C - \*---------------------------------------------------------------------------*/ -#ifndef longLong_H -#define longLong_H - -#include "word.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -class Istream; -class Ostream; +#include "uint64.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//- Return a string representation of a long long -word name(long long); +const uint64_t Foam::pTraits<uint64_t>::zero = 0; +const uint64_t Foam::pTraits<uint64_t>::one = 1; +const uint64_t Foam::pTraits<uint64_t>::min = INT64_MIN; +const uint64_t Foam::pTraits<uint64_t>::max = INT64_MAX; +const uint64_t Foam::pTraits<uint64_t>::rootMin = pTraits<uint64_t>::min; +const uint64_t Foam::pTraits<uint64_t>::rootMax = pTraits<uint64_t>::max; -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // +const char* Foam::pTraits<uint64_t>::componentNames[] = { "x" }; -long long readLongLong(Istream&); -bool readLongLong(const char*, long long&); -Istream& operator>>(Istream&, long long&); -Ostream& operator<<(Ostream&, const long long); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +Foam::pTraits<uint64_t>::pTraits(const uint64_t& p) +: + p_(p) +{} -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +Foam::pTraits<uint64_t>::pTraits(Istream& is) +{ + is >> p_; +} -#endif // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64.H b/src/OpenFOAM/primitives/ints/uint64/uint64.H new file mode 100644 index 0000000000000000000000000000000000000000..deee39fd4e7bd3a106b5f35d6a527e85f6c0e2ac --- /dev/null +++ b/src/OpenFOAM/primitives/ints/uint64/uint64.H @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Primitive + uint64 + +Description + 64bit uinteger + +SourceFiles + uint64.C + uint64IO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef uint64_H +#define uint64_H + +#include <stdint.h> +#include <climits> +#include <cstdlib> + +#include "word.H" +#include "pTraits.H" +#include "direction.H" + +#ifndef UINT64_MIN +#define UINT64_MIN 0 +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class Istream; +class Ostream; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Return a word representation of an uint64 +word name(const uint64_t); + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +uint64_t readUint64(Istream&); +bool read(const char*, uint64_t&); +Istream& operator>>(Istream&, uint64_t&); +Ostream& operator<<(Ostream&, const uint64_t); + +//- template specialization for pTraits<uint64_t> +template<> +class pTraits<uint64_t> +{ + uint64_t p_; + +public: + + //- Component type + typedef uint64_t cmptType; + + // Member constants + + enum + { + dim = 3, //!< Dimensionality of space + rank = 0, //!< Rank of uint64_t is 0 + nComponents = 1 //!< Number of components in uint64_t is 1 + }; + + + // Static data members + + static const char* const typeName; + static const char* componentNames[]; + static const uint64_t zero; + static const uint64_t one; + static const uint64_t min; + static const uint64_t max; + static const uint64_t rootMax; + static const uint64_t rootMin; + + + // Constructors + + //- Construct from primitive + explicit pTraits(const uint64_t&); + + //- Construct from Istream + pTraits(Istream&); + + + // Member Functions + + //- Access to the uint64_t value + operator uint64_t() const + { + return p_; + } + + //- Access to the uint value + operator uint64_t&() + { + return p_; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64IO.C b/src/OpenFOAM/primitives/ints/uint64/uint64IO.C new file mode 100644 index 0000000000000000000000000000000000000000..39737bc9344435917de92c6ee1c7daeb45ba57a2 --- /dev/null +++ b/src/OpenFOAM/primitives/ints/uint64/uint64IO.C @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "error.H" + +#include "uint64.H" +#include "IOstreams.H" + +#include <sstream> + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::word Foam::name(const uint64_t val) +{ + std::ostringstream buf; + buf << val; + return buf.str(); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>>(Istream& is, uint64_t& i) +{ + token t(is); + + if (!t.good()) + { + is.setBad(); + return is; + } + + if (t.isLabel()) + { + i = uint64_t(t.labelToken()); + } + else + { + is.setBad(); + FatalIOErrorIn("operator>>(Istream&, uint64_t&)", is) + << "wrong token type - expected uint64_t, found " << t.info() + << exit(FatalIOError); + + return is; + } + + // Check state of Istream + is.check("Istream& operator>>(Istream&, uint64_t&)"); + + return is; +} + + +uint64_t Foam::readUint64(Istream& is) +{ + uint64_t val; + is >> val; + + return val; +} + + +bool Foam::read(const char* buf, uint64_t& s) +{ + char *endptr = NULL; + long l = strtol(buf, &endptr, 10); + s = uint64_t(l); + return (*endptr == 0); +} + + +Foam::Ostream& Foam::operator<<(Ostream& os, const uint64_t i) +{ + os.write(label(i)); + os.check("Ostream& operator<<(Ostream&, const uint64_t)"); + return os; +} + + +// ************************************************************************* // diff --git a/src/Pstream/gamma/IPread.C b/src/Pstream/gamma/IPread.C index cf0915ec0e65f064d60f9abb49366492c9f24a13..8dfc3c82fbc87502b792ddd77d4376f1b394168a 100644 --- a/src/Pstream/gamma/IPread.C +++ b/src/Pstream/gamma/IPread.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,12 +27,11 @@ Description \*---------------------------------------------------------------------------*/ #include "IPstream.H" -#include "long.H" #include "PstreamGlobals.H" extern "C" { -# include <linux/gamma/libgamma.h> + #include <linux/gamma/libgamma.h> } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/Pstream/gamma/OPwrite.C b/src/Pstream/gamma/OPwrite.C index 7453ef560474e18f421d7c203bc38681b344bebf..81af07f43015981e49574d35140551a79d840303 100644 --- a/src/Pstream/gamma/OPwrite.C +++ b/src/Pstream/gamma/OPwrite.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,13 +27,11 @@ Description \*---------------------------------------------------------------------------*/ #include "OPstream.H" -#include "long.H" #include "PstreamGlobals.H" -extern "C" { - -#include <linux/gamma/libgamma.h> - +extern "C" +{ + #include <linux/gamma/libgamma.h> } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/Pstream/mpi/UPstream.C b/src/Pstream/mpi/UPstream.C index 610c6fa9fec0fc0d7a4a44296fa2689adbe2e498..2020e30c0e382e513ef081e9e11c6b9ec3860a44 100644 --- a/src/Pstream/mpi/UPstream.C +++ b/src/Pstream/mpi/UPstream.C @@ -351,7 +351,13 @@ void Foam::UPstream::allocatePstreamCommunicator // Set the number of processes to the actual number int numProcs; MPI_Comm_size(PstreamGlobals::MPICommunicators_[index], &numProcs); - procIDs_[index] = identity(numProcs); + + //procIDs_[index] = identity(numProcs); + procIDs_[index].setSize(numProcs); + forAll(procIDs_[index], i) + { + procIDs_[index][i] = i; + } } else { diff --git a/src/Pstream/mpi/allReduce.H b/src/Pstream/mpi/allReduce.H index b158518536612c6f47828d74a0108c3dd04e9a9b..ad4f7677dcee8f01ce5c089a9dde285f2654722e 100644 --- a/src/Pstream/mpi/allReduce.H +++ b/src/Pstream/mpi/allReduce.H @@ -53,7 +53,7 @@ void allReduce MPI_Op op, const BinaryOp& bop, const int tag, - const int communicator + const label communicator ); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/Pstream/mpi/allReduceTemplates.C b/src/Pstream/mpi/allReduceTemplates.C index 9a25da1628992b33341caab6cdf1ae1e7bcf57e8..7a07698a77cd91653cbd5d38f75f8c25218f1f43 100644 --- a/src/Pstream/mpi/allReduceTemplates.C +++ b/src/Pstream/mpi/allReduceTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C b/src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C index ea6e6245aa95b6cd0e3052b1392fb8c4785f83e2..b1e6279777b6272b37c6c8dddfe3b87e83e32db8 100644 --- a/src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C +++ b/src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C @@ -57,20 +57,20 @@ namespace Foam Foam::label Foam::metisDecomp::decompose ( - const List<int>& adjncy, - const List<int>& xadj, + const List<label>& adjncy, + const List<label>& xadj, const scalarField& cellWeights, - List<int>& finalDecomp + List<label>& finalDecomp ) { FatalErrorIn ( "labelList metisDecomp::decompose" "(" - "const List<int>&, " - "const List<int>&, " + "const List<label>&, " + "const List<label>&, " "const scalarField&, " - "List<int>&" + "List<label>&" ")" ) << notImplementedMessage << exit(FatalError); diff --git a/src/dummyThirdParty/ptscotchDecomp/dummyPtscotchDecomp.C b/src/dummyThirdParty/ptscotchDecomp/dummyPtscotchDecomp.C index 36d405d59757fd4eecbcad5467745adc8af835d3..adc13ad06782da23cbe5f1b7d253a7785fa45f85 100644 --- a/src/dummyThirdParty/ptscotchDecomp/dummyPtscotchDecomp.C +++ b/src/dummyThirdParty/ptscotchDecomp/dummyPtscotchDecomp.C @@ -61,11 +61,11 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str) Foam::label Foam::ptscotchDecomp::decompose ( const fileName& meshPath, - const List<int>& initxadj, - const List<int>& initadjncy, + const List<label>& initxadj, + const List<label>& initadjncy, const scalarField& initcWeights, - List<int>& finalDecomp + List<label>& finalDecomp ) const { FatalErrorIn @@ -73,24 +73,26 @@ Foam::label Foam::ptscotchDecomp::decompose "label ptscotchDecomp::decompose" "(" "onst fileName&," - "const List<int>&, " - "const List<int>&, " + "const List<label>&, " + "const List<label>&, " "const scalarField&, " - "List<int>&" + "List<label>&" ")" ) << notImplementedMessage << exit(FatalError); return -1; } + + Foam::label Foam::ptscotchDecomp::decompose ( const fileName& meshPath, - const int adjncySize, - const int adjncy[], - const int xadjSize, - const int xadj[], + const label adjncySize, + const label adjncy[], + const label xadjSize, + const label xadj[], const scalarField& cWeights, - List<int>& finalDecomp + List<label>& finalDecomp ) const { FatalErrorIn @@ -103,7 +105,7 @@ Foam::label Foam::ptscotchDecomp::decompose "const int," "const int," "const scalarField&," - "List<int>&" + "List<label>&" ")" ) << notImplementedMessage << exit(FatalError); diff --git a/src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C b/src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C index ebb935cebcec5267d637a4a7de41bf7ac7b032f4..3929b7a0c1d374c77c7083af23c0338872fbedb1 100644 --- a/src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C +++ b/src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,11 +60,11 @@ void Foam::scotchDecomp::check(const int retVal, const char* str) Foam::label Foam::scotchDecomp::decompose ( const fileName& meshPath, - const List<int>& adjncy, - const List<int>& xadj, + const List<label>& adjncy, + const List<label>& xadj, const scalarField& cWeights, - List<int>& finalDecomp + List<label>& finalDecomp ) { FatalErrorIn @@ -72,10 +72,10 @@ Foam::label Foam::scotchDecomp::decompose "label scotchDecomp::decompose\n" "(\n" "const fileName& meshPath,\n" - "const List<int>&,\n" - "const List<int>&,\n" + "const List<label>&,\n" + "const List<label>&,\n" "const scalarField&,\n" - "List<int>&\n" + "List<label>&\n" ")\n" ) << notImplementedMessage << exit(FatalError); diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H index a35304b132b1a37261cc7ed430542fe47d04de87..26437fc1a0fb4a1d140ad9768e133e342d23d530 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H @@ -248,7 +248,7 @@ public: //- Processor coupled interface functions //- Return communicator used for comms - virtual int comm() const + virtual label comm() const { return procPatch_.comm(); } diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index 47c03db1156ce2a84e7546484850c142cd0cef17..7efd8defca27aa3d266aef3865bfcb6f09136a8d 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -274,7 +274,7 @@ public: } //- Return communicator used for parallel communication - virtual int comm() const + virtual label comm() const { return polyMesh::comm(); } diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H index 4ccb029a73dfc2406c7cba42e1689cc491f3ee72..960bd307767e9d39801884cec07b1fc414194f7f 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H @@ -85,7 +85,7 @@ public: // Member functions //- Return communicator used for comms - virtual int comm() const + virtual label comm() const { return procPolyPatch_.comm(); } diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index 006ead54fba0feaeb5da95729a8d2748e4127806..41e6ca0dccc5807d7d3234bea387e84be0ba60d9 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -2656,8 +2656,18 @@ void Foam::autoSnapDriver::doSnap ( regionSide ); - meshRefinement::updateList(mapPtr().faceMap(), -1, filterFace); - meshRefinement::updateList(mapPtr().faceMap(), -1, duplicateFace); + meshRefinement::updateList + ( + mapPtr().faceMap(), + label(-1), + filterFace + ); + meshRefinement::updateList + ( + mapPtr().faceMap(), + label(-1), + duplicateFace + ); // Update baffles and baffle-to-baffle addressing @@ -3187,7 +3197,12 @@ void Foam::autoSnapDriver::doSnap adaptPatchIDs, duplicateFace ); - meshRefinement::updateList(mapPtr().faceMap(), -1, duplicateFace); + meshRefinement::updateList + ( + mapPtr().faceMap(), + label(-1), + duplicateFace + ); } // Repatching might have caused faces to be on same patch and hence diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C index b1cc58a0518dd51fb0934b71eb0a2e1710adeaf2..5a0bf08e100fee7384f5eeb30b429840597f0a6b 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C @@ -196,7 +196,7 @@ void Foam::autoSnapDriver::smoothAndConstrain pp.meshPoints(), dispCount, plusEqOp<label>(), - 0, + label(0), mapDistribute::transform() ); diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C index e78b54f02d388a661c745f0580e188d7651c616b..8cf215729d9323fc7176a4d399b75f9fac2c18b8 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C @@ -1914,7 +1914,7 @@ void Foam::meshRefinement::calcPatchNumMasterFaces patch.meshEdges(mesh_.edges(), mesh_.pointEdges()), nMasterFacesPerEdge, plusEqOp<label>(), - 0 + label(0) ); } diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H index ff99788f7e6bc0d39321bf462ada2e2795e27f96..6527c42cb79934ab1fda330bc7b0ec12cf52ed48 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H @@ -65,7 +65,7 @@ template < class PrimitivePatchType, class Type, - class TrackingData = int + class TrackingData = label > class PatchEdgeFaceWave : diff --git a/src/meshTools/searchableSurface/searchableSurface.C b/src/meshTools/searchableSurface/searchableSurface.C index 838135df65ef878e059613399eecac7d37640975..59151953846fec5bdd3edc5b0bdcd6408162e5ee 100644 --- a/src/meshTools/searchableSurface/searchableSurface.C +++ b/src/meshTools/searchableSurface/searchableSurface.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,16 +24,13 @@ License \*---------------------------------------------------------------------------*/ #include "searchableSurface.H" -#include "long.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -defineTypeNameAndDebug(searchableSurface, 0); -defineRunTimeSelectionTable(searchableSurface, dict); - + defineTypeNameAndDebug(searchableSurface, 0); + defineRunTimeSelectionTable(searchableSurface, dict); } diff --git a/src/parallel/decompose/metisDecomp/metisDecomp.C b/src/parallel/decompose/metisDecomp/metisDecomp.C index 33d9e4db05eaeae7dd06738d6426c3f5ef4f13f5..f14ef21e9240ef9164ddfdd47f926c71bb16d374 100644 --- a/src/parallel/decompose/metisDecomp/metisDecomp.C +++ b/src/parallel/decompose/metisDecomp/metisDecomp.C @@ -50,11 +50,11 @@ namespace Foam // Call Metis with options from dictionary. Foam::label Foam::metisDecomp::decompose ( - const List<int>& adjncy, - const List<int>& xadj, + const List<label>& adjncy, + const List<label>& xadj, const scalarField& cWeights, - List<int>& finalDecomp + List<label>& finalDecomp ) { // C style numbering @@ -65,10 +65,10 @@ Foam::label Foam::metisDecomp::decompose // k-way: multi-level k-way word method("recursive"); - int numCells = xadj.size()-1; + label numCells = xadj.size()-1; // decomposition options - List<int> options(METIS_NOPTIONS); + List<label> options(METIS_NOPTIONS); METIS_SetDefaultOptions(options.begin()); // processor weights initialised with no size, only used if specified in @@ -76,10 +76,10 @@ Foam::label Foam::metisDecomp::decompose Field<floatScalar> processorWeights; // cell weights (so on the vertices of the dual) - List<int> cellWeights; + List<label> cellWeights; // face weights (so on the edges of the dual) - List<int> faceWeights; + List<label> faceWeights; // Check for externally provided cellweights and if so initialise weights @@ -170,7 +170,7 @@ Foam::label Foam::metisDecomp::decompose //{ // Info<< "metisDecomp : Using cell-based weights." << endl; // - // IOList<int> cellIOWeights + // IOList<label> cellIOWeights // ( // IOobject // ( @@ -209,8 +209,8 @@ Foam::label Foam::metisDecomp::decompose ( &numCells, // num vertices in graph &ncon, // num balancing constraints - const_cast<List<int>&>(xadj).begin(), // indexing into adjncy - const_cast<List<int>&>(adjncy).begin(), // neighbour info + const_cast<List<label>&>(xadj).begin(), // indexing into adjncy + const_cast<List<label>&>(adjncy).begin(), // neighbour info cellWeights.begin(),// vertexweights NULL, // vsize: total communication vol faceWeights.begin(),// edgeweights @@ -228,8 +228,8 @@ Foam::label Foam::metisDecomp::decompose ( &numCells, // num vertices in graph &ncon, // num balancing constraints - const_cast<List<int>&>(xadj).begin(), // indexing into adjncy - const_cast<List<int>&>(adjncy).begin(), // neighbour info + const_cast<List<label>&>(xadj).begin(), // indexing into adjncy + const_cast<List<label>&>(adjncy).begin(), // neighbour info cellWeights.begin(),// vertexweights NULL, // vsize: total communication vol faceWeights.begin(),// edgeweights diff --git a/src/parallel/decompose/metisDecomp/metisDecomp.H b/src/parallel/decompose/metisDecomp/metisDecomp.H index 4bcd1b6eb7a7b73ad63ee5be490193dc01ad6c48..c347753edb61dfa7bb6fab1fe8761db271d304ab 100644 --- a/src/parallel/decompose/metisDecomp/metisDecomp.H +++ b/src/parallel/decompose/metisDecomp/metisDecomp.H @@ -53,10 +53,10 @@ class metisDecomp label decompose ( - const List<int>& adjncy, - const List<int>& xadj, + const List<label>& adjncy, + const List<label>& xadj, const scalarField& cellWeights, - List<int>& finalDecomp + List<label>& finalDecomp ); //- Disallow default bitwise copy construct and assignment diff --git a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C index 3791ad53de95d39598e85810f674f489fcde4327..049dc6b290a6195dc743dd926514f368c9c535d4 100644 --- a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C +++ b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C @@ -163,11 +163,11 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str) //Foam::label Foam::ptscotchDecomp::decomposeZeroDomains //( // const fileName& meshPath, -// const List<int>& initadjncy, -// const List<int>& initxadj, +// const List<label>& initadjncy, +// const List<label>& initxadj, // const scalarField& initcWeights, // -// List<int>& finalDecomp +// List<label>& finalDecomp //) const //{ // globalIndex globalCells(initxadj.size()-1); @@ -210,7 +210,7 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str) // // // Number of cells to send to the next processor // // (is same as number of cells next processor has to receive) -// List<int> nSendCells(Pstream::nProcs(), 0); +// List<label> nSendCells(Pstream::nProcs(), 0); // // for (label procI = nSendCells.size()-1; procI >=1; procI--) // { @@ -262,10 +262,10 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str) // // Send cells to next processor // OPstream toNextProc(Pstream::blocking, Pstream::myProcNo()+1); // -// int nCells = nSendCells[Pstream::myProcNo()]; -// int startCell = xadj.size()-1 - nCells; -// int startFace = xadj[startCell]; -// int nFaces = adjncy.size()-startFace; +// label nCells = nSendCells[Pstream::myProcNo()]; +// label startCell = xadj.size()-1 - nCells; +// label startFace = xadj[startCell]; +// label nFaces = adjncy.size()-startFace; // // // Send for all cell data: last nCells elements // // Send for all face data: last nFaces elements @@ -311,7 +311,7 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str) // { // IPstream fromNextProc(Pstream::blocking, Pstream::myProcNo()+1); // -// List<int> nextFinalDecomp(fromNextProc); +// List<label> nextFinalDecomp(fromNextProc); // // if (nextFinalDecomp.size() != nSendCells[Pstream::myProcNo()]) // { @@ -330,10 +330,10 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str) // { // OPstream toPrevProc(Pstream::blocking, Pstream::myProcNo()-1); // -// int nToPrevious = nSendCells[Pstream::myProcNo()-1]; +// label nToPrevious = nSendCells[Pstream::myProcNo()-1]; // // toPrevProc << -// SubList<int> +// SubList<label> // ( // finalDecomp, // nToPrevious, @@ -351,14 +351,14 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str) Foam::label Foam::ptscotchDecomp::decompose ( const fileName& meshPath, - const List<int>& adjncy, - const List<int>& xadj, + const List<label>& adjncy, + const List<label>& xadj, const scalarField& cWeights, - List<int>& finalDecomp + List<label>& finalDecomp ) const { - List<int> dummyAdjncy(1); - List<int> dummyXadj(1); + List<label> dummyAdjncy(1); + List<label> dummyXadj(1); dummyXadj[0] = 0; return decompose @@ -378,13 +378,13 @@ Foam::label Foam::ptscotchDecomp::decompose Foam::label Foam::ptscotchDecomp::decompose ( const fileName& meshPath, - const int adjncySize, - const int adjncy[], - const int xadjSize, - const int xadj[], + const label adjncySize, + const label adjncy[], + const label xadjSize, + const label xadj[], const scalarField& cWeights, - List<int>& finalDecomp + List<label>& finalDecomp ) const { if (debug) @@ -477,7 +477,7 @@ Foam::label Foam::ptscotchDecomp::decompose // Graph // ~~~~~ - List<int> velotab; + List<label> velotab; // Check for externally provided cellweights and if so initialise weights @@ -766,7 +766,7 @@ Foam::labelList Foam::ptscotchDecomp::decompose ); // Decompose using default weights - List<int> finalDecomp; + List<label> finalDecomp; decompose ( mesh.time().path()/mesh.name(), @@ -819,7 +819,7 @@ Foam::labelList Foam::ptscotchDecomp::decompose ); // Decompose using weights - List<int> finalDecomp; + List<label> finalDecomp; decompose ( mesh.time().path()/mesh.name(), @@ -866,7 +866,7 @@ Foam::labelList Foam::ptscotchDecomp::decompose CompactListList<label> cellCells(globalCellCells); // Decompose using weights - List<int> finalDecomp; + List<label> finalDecomp; decompose ( "ptscotch", diff --git a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.H b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.H index 7f59e53fb1e7c0b665e1ffa3686121371a4a19ae..0930885525024de11cbf6c6f19c54785e9d6773f 100644 --- a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.H +++ b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.H @@ -64,22 +64,22 @@ class ptscotchDecomp label decompose ( const fileName& meshPath, - const List<int>& adjncy, - const List<int>& xadj, + const List<label>& adjncy, + const List<label>& xadj, const scalarField& cWeights, - List<int>& finalDecomp + List<label>& finalDecomp ) const; //- Low level decompose label decompose ( const fileName& meshPath, - const int adjncySize, - const int adjncy[], - const int xadjSize, - const int xadj[], + const label adjncySize, + const label adjncy[], + const label xadjSize, + const label xadj[], const scalarField& cWeights, - List<int>& finalDecomp + List<label>& finalDecomp ) const; //- Disallow default bitwise copy construct and assignment diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.C b/src/parallel/decompose/scotchDecomp/scotchDecomp.C index 1715f316f27f58085da5339043486dbdf8331932..0095ad0513b0de2457ea868f3dd07240fcbe480e 100644 --- a/src/parallel/decompose/scotchDecomp/scotchDecomp.C +++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.C @@ -173,11 +173,11 @@ void Foam::scotchDecomp::check(const int retVal, const char* str) Foam::label Foam::scotchDecomp::decompose ( const fileName& meshPath, - const List<int>& adjncy, - const List<int>& xadj, + const List<label>& adjncy, + const List<label>& xadj, const scalarField& cWeights, - List<int>& finalDecomp + List<label>& finalDecomp ) { if (!Pstream::parRun()) @@ -204,8 +204,8 @@ Foam::label Foam::scotchDecomp::decompose // Send all to master. Use scheduled to save some storage. if (Pstream::master()) { - Field<int> allAdjncy(nTotalConnections); - Field<int> allXadj(globalCells.size()+1); + Field<label> allAdjncy(nTotalConnections); + Field<label> allXadj(globalCells.size()+1); scalarField allWeights(globalCells.size()); // Insert my own @@ -224,8 +224,8 @@ Foam::label Foam::scotchDecomp::decompose for (int slave=1; slave<Pstream::nProcs(); slave++) { IPstream fromSlave(Pstream::scheduled, slave); - Field<int> nbrAdjncy(fromSlave); - Field<int> nbrXadj(fromSlave); + Field<label> nbrAdjncy(fromSlave); + Field<label> nbrXadj(fromSlave); scalarField nbrWeights(fromSlave); // Append. @@ -244,7 +244,7 @@ Foam::label Foam::scotchDecomp::decompose allXadj[nTotalCells] = nTotalConnections; - Field<int> allFinalDecomp; + Field<label> allFinalDecomp; decomposeOneProc ( meshPath, @@ -259,7 +259,7 @@ Foam::label Foam::scotchDecomp::decompose for (int slave=1; slave<Pstream::nProcs(); slave++) { OPstream toSlave(Pstream::scheduled, slave); - toSlave << SubField<int> + toSlave << SubField<label> ( allFinalDecomp, globalCells.localSize(slave), @@ -267,7 +267,7 @@ Foam::label Foam::scotchDecomp::decompose ); } // Get my own part (always first) - finalDecomp = SubField<int> + finalDecomp = SubField<label> ( allFinalDecomp, globalCells.localSize() @@ -278,7 +278,7 @@ Foam::label Foam::scotchDecomp::decompose // Send my part of the graph (already in global numbering) { OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); - toMaster<< adjncy << SubField<int>(xadj, xadj.size()-1) + toMaster<< adjncy << SubField<label>(xadj, xadj.size()-1) << cWeights; } @@ -295,11 +295,11 @@ Foam::label Foam::scotchDecomp::decompose Foam::label Foam::scotchDecomp::decomposeOneProc ( const fileName& meshPath, - const List<int>& adjncy, - const List<int>& xadj, + const List<label>& adjncy, + const List<label>& xadj, const scalarField& cWeights, - List<int>& finalDecomp + List<label>& finalDecomp ) { // Dump graph @@ -372,7 +372,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc // Graph // ~~~~~ - List<int> velotab; + List<label> velotab; // Check for externally provided cellweights and if so initialise weights @@ -625,7 +625,7 @@ Foam::labelList Foam::scotchDecomp::decompose ); // Decompose using default weights - List<int> finalDecomp; + List<label> finalDecomp; decompose ( mesh.time().path()/mesh.name(), @@ -677,7 +677,7 @@ Foam::labelList Foam::scotchDecomp::decompose ); // Decompose using weights - List<int> finalDecomp; + List<label> finalDecomp; decompose ( mesh.time().path()/mesh.name(), @@ -725,7 +725,7 @@ Foam::labelList Foam::scotchDecomp::decompose CompactListList<label> cellCells(globalCellCells); // Decompose using weights - List<int> finalDecomp; + List<label> finalDecomp; decompose ( "scotch", diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.H b/src/parallel/decompose/scotchDecomp/scotchDecomp.H index 98d509f87e0df27c081becd800249f0a2d8fc7db..3c044941d0a41dfa9bad83d360773716b334883a 100644 --- a/src/parallel/decompose/scotchDecomp/scotchDecomp.H +++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.H @@ -59,20 +59,20 @@ class scotchDecomp label decompose ( const fileName& meshPath, - const List<int>& adjncy, - const List<int>& xadj, + const List<label>& adjncy, + const List<label>& xadj, const scalarField& cWeights, - List<int>& finalDecomp + List<label>& finalDecomp ); //- Decompose non-parallel label decomposeOneProc ( const fileName& meshPath, - const List<int>& adjncy, - const List<int>& xadj, + const List<label>& adjncy, + const List<label>& xadj, const scalarField& cWeights, - List<int>& finalDecomp + List<label>& finalDecomp ); //- Disallow default bitwise copy construct and assignment diff --git a/wmake/rules/General/general b/wmake/rules/General/general index f9f83f061b565421b701291d78c81fb3ba459c41..ecbe83a14e4ec208366d045c91bb2149222d2016 100644 --- a/wmake/rules/General/general +++ b/wmake/rules/General/general @@ -6,7 +6,7 @@ RANLIB = ranlib CPP = cpp LD = ld -GFLAGS = -D$(WM_ARCH) -DWM_$(WM_PRECISION_OPTION) +GFLAGS = -D$(WM_ARCH) -DWM_$(WM_PRECISION_OPTION) -DWM_LABEL_SIZE=$(WM_LABEL_SIZE) GINC = GLIBS = -lm GLIB_LIBS =