Added and verified support for 64bit labels

To compile with 64bit labels set

WM_LABEL_SIZE=64

in ~/OpenFOAM/dev/prefs.sh

source ~/.bashrc

then Allwmake in OpenFOAM-dev.

This will build into for example OpenFOAM-dev/platforms/linux64ClangDPInt64Opt

If WM_LABEL_SIZE is unset or set to 32:

WM_LABEL_SIZE=32

the build would be placed into OpenFOAM-dev/platforms/linux64ClangDPInt32Opt

Thus both 32bit and 64bit label builds can coexist without problem.
This commit is contained in:
Henry
2014-12-31 19:02:52 +00:00
parent ff52b0c485
commit 2a614865ff
116 changed files with 1515 additions and 1242 deletions

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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)
{

View File

@ -43,7 +43,6 @@ SourceFiles
#include "CGALTriangulation3Ddefs.H"
#include "uint.H"
#include "ulong.H"
#include "searchableSurfaces.H"
#include "conformationSurfaces.H"
#include "cellShapeControl.H"

View File

@ -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

View File

@ -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)
{

View File

@ -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
(

View File

@ -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
(

View File

@ -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
(

View File

@ -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();

View File

@ -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)

View File

@ -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();

View File

@ -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_;
}

View File

@ -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();

View File

@ -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_;
}

View File

@ -299,7 +299,7 @@ bool Foam::autoDensity::fillBox
{
const conformationSurfaces& geometry = geometryToConformTo();
unsigned int initialSize = initialPoints.size();
label initialSize = initialPoints.size();
scalar maxCellSize = -GREAT;

View File

@ -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 =

View File

@ -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 =

View File

@ -28,7 +28,6 @@ License
#include "transform.H"
#include "IFstream.H"
#include "uint.H"
#include "ulong.H"
namespace Foam
{

View File

@ -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,

View File

@ -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>&
);
};