Commit a2eabf3c authored by Kirill Terekhov's avatar Kirill Terekhov

Compliance with old compilers

Maybe fixes VS2005/VS2008 compilation.
Should fix old gcc.
parent f61ddc5f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#if defined(USE_MESH) #if defined(USE_MESH)
namespace INMOST namespace INMOST
{ {
int Mesh::CentroidComparator::Compare(const real * a, const real * b) int Mesh::CentroidComparator::Compare(const real * a, const real * b) const
{ {
real e = m->GetEpsilon(); real e = m->GetEpsilon();
for(integer i = 0; i < m->GetDimensions(); i++) for(integer i = 0; i < m->GetDimensions(); i++)
...@@ -16,7 +16,7 @@ namespace INMOST ...@@ -16,7 +16,7 @@ namespace INMOST
return 0; return 0;
} }
bool Mesh::CentroidComparator::operator () (HandleType a, HandleType b) bool Mesh::CentroidComparator::operator () (HandleType a, HandleType b) const
{ {
if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; if( a == InvalidHandle() || b == InvalidHandle() ) return a > b;
real ca[3] = {0,0,0}, cb[3] = {0,0,0}; real ca[3] = {0,0,0}, cb[3] = {0,0,0};
...@@ -25,7 +25,7 @@ namespace INMOST ...@@ -25,7 +25,7 @@ namespace INMOST
return Compare(ca,cb) < 0; return Compare(ca,cb) < 0;
} }
bool Mesh::CentroidComparator::operator () (HandleType a, const real * cb) bool Mesh::CentroidComparator::operator () (HandleType a, const real * cb) const
{ {
if( a == InvalidHandle() ) return true; if( a == InvalidHandle() ) return true;
real ca[3] = {0,0,0}; real ca[3] = {0,0,0};
...@@ -33,8 +33,16 @@ namespace INMOST ...@@ -33,8 +33,16 @@ namespace INMOST
return Compare(ca,cb) < 0; return Compare(ca,cb) < 0;
} }
bool Mesh::CentroidComparator::operator () (const real * ca, HandleType b) const
{
if( b == InvalidHandle() ) return false;
real cb[3] = {0,0,0};
m->GetGeometricData(b,CENTROID,cb);
return Compare(ca,cb) < 0;
}
int Mesh::IerarhyComparator::CompareNodes(HandleType a, HandleType b) int Mesh::IerarhyComparator::CompareNodes(HandleType a, HandleType b) const
{ {
real_array ca = m->RealArrayDF(a,m->CoordsTag()); real_array ca = m->RealArrayDF(a,m->CoordsTag());
real_array cb = m->RealArrayDF(b,m->CoordsTag()); real_array cb = m->RealArrayDF(b,m->CoordsTag());
...@@ -49,7 +57,7 @@ namespace INMOST ...@@ -49,7 +57,7 @@ namespace INMOST
} }
return 0; return 0;
} }
int Mesh::IerarhyComparator::CompareElements(HandleType a, HandleType b) int Mesh::IerarhyComparator::CompareElements(HandleType a, HandleType b) const
{ {
integer ia = GetHandleElementNum(a); integer ia = GetHandleElementNum(a);
integer ib = GetHandleElementNum(b); integer ib = GetHandleElementNum(b);
......
#define _HAS_ITERATOR_DEBUGGING 0
#include "inmost.h" #include "inmost.h"
#if defined(USE_MESH) #if defined(USE_MESH)
......
...@@ -2687,9 +2687,10 @@ namespace INMOST ...@@ -2687,9 +2687,10 @@ namespace INMOST
CentroidComparator(Mesh * m) :m(m) {} CentroidComparator(Mesh * m) :m(m) {}
CentroidComparator(const CentroidComparator & other) :m(other.m){} CentroidComparator(const CentroidComparator & other) :m(other.m){}
CentroidComparator & operator = (CentroidComparator const & other) { m = other.m; return *this;} CentroidComparator & operator = (CentroidComparator const & other) { m = other.m; return *this;}
int Compare(const real * a, const real * b); int Compare(const real * a, const real * b) const;
bool operator() (HandleType a, HandleType b); bool operator() (HandleType a, HandleType b) const;
bool operator() (HandleType a, const real * b); bool operator() (HandleType a, const real * b) const;
bool operator() (const real * a, HandleType b) const;
}; };
class GlobalIDComparator class GlobalIDComparator
...@@ -2699,8 +2700,8 @@ namespace INMOST ...@@ -2699,8 +2700,8 @@ namespace INMOST
GlobalIDComparator(Mesh * m) :m(m) {} GlobalIDComparator(Mesh * m) :m(m) {}
GlobalIDComparator(const GlobalIDComparator & other) :m(other.m){} GlobalIDComparator(const GlobalIDComparator & other) :m(other.m){}
GlobalIDComparator & operator = (GlobalIDComparator const & other) { m = other.m; return *this;} GlobalIDComparator & operator = (GlobalIDComparator const & other) { m = other.m; return *this;}
bool operator() (HandleType a, HandleType b) {if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->GlobalID(a) < m->GlobalID(b);} bool operator() (HandleType a, HandleType b) const {if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->GlobalID(a) < m->GlobalID(b);}
bool operator() (HandleType a, integer gid) {if( a == InvalidHandle() ) return false; return m->GlobalID(a) < gid;} bool operator() (HandleType a, integer gid) const {if( a == InvalidHandle() ) return false; return m->GlobalID(a) < gid;}
}; };
class IerarhyComparator class IerarhyComparator
...@@ -2710,9 +2711,9 @@ namespace INMOST ...@@ -2710,9 +2711,9 @@ namespace INMOST
IerarhyComparator(Mesh * m) :m(m) {} IerarhyComparator(Mesh * m) :m(m) {}
IerarhyComparator(const IerarhyComparator & other) :m(other.m){} IerarhyComparator(const IerarhyComparator & other) :m(other.m){}
IerarhyComparator & operator = (IerarhyComparator const & other) { m = other.m; return *this;} IerarhyComparator & operator = (IerarhyComparator const & other) { m = other.m; return *this;}
int CompareNodes(HandleType a, HandleType b); int CompareNodes(HandleType a, HandleType b) const;
int CompareElements(HandleType a, HandleType b); int CompareElements(HandleType a, HandleType b) const;
bool operator() (HandleType a, HandleType b) {if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return CompareElements(a,b) < 0;} bool operator() (HandleType a, HandleType b) const {if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return CompareElements(a,b) < 0;}
}; };
class RealComparator class RealComparator
...@@ -2722,8 +2723,8 @@ namespace INMOST ...@@ -2722,8 +2723,8 @@ namespace INMOST
RealComparator(Mesh * m, Tag t) :m(m), t(t) {} RealComparator(Mesh * m, Tag t) :m(m), t(t) {}
RealComparator(const RealComparator & other) :m(other.m), t(other.t){} RealComparator(const RealComparator & other) :m(other.m), t(other.t){}
RealComparator & operator = (RealComparator const & other) { m = other.m; t = other.t; return *this;} RealComparator & operator = (RealComparator const & other) { m = other.m; t = other.t; return *this;}
bool operator() (HandleType a, HandleType b){if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->Real(a,t) < m->Real(b,t);} bool operator() (HandleType a, HandleType b) const {if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->Real(a,t) < m->Real(b,t);}
bool operator() (HandleType a, real b) {if( a == InvalidHandle() ) return true; return m->Real(a,t) < b;} bool operator() (HandleType a, real b) const {if( a == InvalidHandle() ) return true; return m->Real(a,t) < b;}
}; };
class IntegerComparator class IntegerComparator
...@@ -2733,8 +2734,8 @@ namespace INMOST ...@@ -2733,8 +2734,8 @@ namespace INMOST
IntegerComparator(Mesh * m, Tag t) :m(m), t(t) {} IntegerComparator(Mesh * m, Tag t) :m(m), t(t) {}
IntegerComparator(const IntegerComparator & other) :m(other.m), t(other.t){} IntegerComparator(const IntegerComparator & other) :m(other.m), t(other.t){}
IntegerComparator & operator = (IntegerComparator const & other) { m = other.m; t = other.t; return *this;} IntegerComparator & operator = (IntegerComparator const & other) { m = other.m; t = other.t; return *this;}
bool operator() (HandleType a, HandleType b){if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->Integer(a,t) < m->Integer(b,t);} bool operator() (HandleType a, HandleType b) const {if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->Integer(a,t) < m->Integer(b,t);}
bool operator() (HandleType a, integer b) {if( a == InvalidHandle() ) return true; return m->Integer(a,t) < b;} bool operator() (HandleType a, integer b) const {if( a == InvalidHandle() ) return true; return m->Integer(a,t) < b;}
}; };
class BulkComparator class BulkComparator
...@@ -2744,8 +2745,8 @@ namespace INMOST ...@@ -2744,8 +2745,8 @@ namespace INMOST
BulkComparator(Mesh * m, Tag t) :m(m), t(t) {} BulkComparator(Mesh * m, Tag t) :m(m), t(t) {}
BulkComparator(const BulkComparator & other) :m(other.m), t(other.t){} BulkComparator(const BulkComparator & other) :m(other.m), t(other.t){}
BulkComparator & operator = (BulkComparator const & other) { m = other.m; t = other.t; return *this;} BulkComparator & operator = (BulkComparator const & other) { m = other.m; t = other.t; return *this;}
bool operator() (HandleType a, HandleType b){if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->Bulk(a,t) < m->Bulk(b,t);} bool operator() (HandleType a, HandleType b) const {if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->Bulk(a,t) < m->Bulk(b,t);}
bool operator() (HandleType a, bulk b) {if( a == InvalidHandle() ) return true; return m->Bulk(a,t) < b;} bool operator() (HandleType a, bulk b) const {if( a == InvalidHandle() ) return true; return m->Bulk(a,t) < b;}
}; };
class RealDFComparator class RealDFComparator
...@@ -2755,8 +2756,8 @@ namespace INMOST ...@@ -2755,8 +2756,8 @@ namespace INMOST
RealDFComparator(Mesh * m, Tag t) :m(m), t(t) {} RealDFComparator(Mesh * m, Tag t) :m(m), t(t) {}
RealDFComparator(const RealDFComparator & other) :m(other.m), t(other.t){} RealDFComparator(const RealDFComparator & other) :m(other.m), t(other.t){}
RealDFComparator & operator = (RealDFComparator const & other) { m = other.m; t = other.t; return *this;} RealDFComparator & operator = (RealDFComparator const & other) { m = other.m; t = other.t; return *this;}
bool operator() (HandleType a, HandleType b){if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->RealDF(a,t) < m->RealDF(b,t);} bool operator() (HandleType a, HandleType b) const {if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->RealDF(a,t) < m->RealDF(b,t);}
bool operator() (HandleType a, real b) {if( a == InvalidHandle() ) return true; return m->RealDF(a,t) < b;} bool operator() (HandleType a, real b) const {if( a == InvalidHandle() ) return true; return m->RealDF(a,t) < b;}
}; };
class IntegerDFComparator class IntegerDFComparator
...@@ -2766,8 +2767,8 @@ namespace INMOST ...@@ -2766,8 +2767,8 @@ namespace INMOST
IntegerDFComparator(Mesh * m, Tag t) :m(m), t(t) {} IntegerDFComparator(Mesh * m, Tag t) :m(m), t(t) {}
IntegerDFComparator(const IntegerDFComparator & other) :m(other.m), t(other.t){} IntegerDFComparator(const IntegerDFComparator & other) :m(other.m), t(other.t){}
IntegerDFComparator & operator = (IntegerDFComparator const & other) { m = other.m; t = other.t; return *this;} IntegerDFComparator & operator = (IntegerDFComparator const & other) { m = other.m; t = other.t; return *this;}
bool operator() (HandleType a, HandleType b){if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->IntegerDF(a,t) < m->IntegerDF(b,t);} bool operator() (HandleType a, HandleType b) const {if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->IntegerDF(a,t) < m->IntegerDF(b,t);}
bool operator() (HandleType a, integer b) {if( a == InvalidHandle() ) return true; return m->IntegerDF(a,t) < b;} bool operator() (HandleType a, integer b) const {if( a == InvalidHandle() ) return true; return m->IntegerDF(a,t) < b;}
}; };
class BulkDFComparator class BulkDFComparator
...@@ -2777,8 +2778,8 @@ namespace INMOST ...@@ -2777,8 +2778,8 @@ namespace INMOST
BulkDFComparator(Mesh * m, Tag t) :m(m), t(t) {} BulkDFComparator(Mesh * m, Tag t) :m(m), t(t) {}
BulkDFComparator(const BulkDFComparator & other) :m(other.m), t(other.t){} BulkDFComparator(const BulkDFComparator & other) :m(other.m), t(other.t){}
BulkDFComparator & operator = (BulkDFComparator const & other) { m = other.m; t = other.t; return *this;} BulkDFComparator & operator = (BulkDFComparator const & other) { m = other.m; t = other.t; return *this;}
bool operator() (HandleType a, HandleType b){if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->BulkDF(a,t) < m->BulkDF(b,t);} bool operator() (HandleType a, HandleType b) const {if( a == InvalidHandle() || b == InvalidHandle() ) return a > b; return m->BulkDF(a,t) < m->BulkDF(b,t);}
bool operator() (HandleType a, bulk b) {if( a == InvalidHandle() ) return true; return m->BulkDF(a,t) < b;} bool operator() (HandleType a, bulk b) const {if( a == InvalidHandle() ) return true; return m->BulkDF(a,t) < b;}
}; };
void SortHandles(HandleType * h, enumerator num); void SortHandles(HandleType * h, enumerator num);
......
...@@ -303,7 +303,7 @@ namespace INMOST ...@@ -303,7 +303,7 @@ namespace INMOST
{ {
assert(have_dimens); assert(have_dimens);
if( xyz.empty() ) xyz.resize(3*dims[0]*dims[1]*dims[2]); if( xyz.empty() ) xyz.resize(3*dims[0]*dims[1]*dims[2]);
read_arrayf = xyz.data(); read_arrayf = xyz.empty()? NULL : &xyz[0];
numrecs = 3; numrecs = 3;
downread = totread = dims[0]*dims[1]*dims[2]; downread = totread = dims[0]*dims[1]*dims[2];
argtype = ECL_VAR_REAL; argtype = ECL_VAR_REAL;
...@@ -313,7 +313,7 @@ namespace INMOST ...@@ -313,7 +313,7 @@ namespace INMOST
{ {
assert(have_dimens); assert(have_dimens);
if( xyz.empty() ) xyz.resize(3*dims[0]*dims[1]*dims[2]); if( xyz.empty() ) xyz.resize(3*dims[0]*dims[1]*dims[2]);
read_arrayf = xyz.data(); read_arrayf = xyz.empty() ? NULL : &xyz[0];
numrecs = 3; numrecs = 3;
downread = totread = dims[0]*dims[1]*dims[2]; downread = totread = dims[0]*dims[1]*dims[2];
argtype = ECL_VAR_REAL; argtype = ECL_VAR_REAL;
...@@ -324,7 +324,7 @@ namespace INMOST ...@@ -324,7 +324,7 @@ namespace INMOST
{ {
assert(have_dimens); assert(have_dimens);
if( xyz.empty() ) xyz.resize(3*dims[0]*dims[1]*dims[2]); if( xyz.empty() ) xyz.resize(3*dims[0]*dims[1]*dims[2]);
read_arrayf = xyz.data(); read_arrayf = xyz.empty() ? NULL : &xyz[0];
numrecs = 3; numrecs = 3;
downread = totread = dims[0]*dims[1]*dims[2]; downread = totread = dims[0]*dims[1]*dims[2];
argtype = ECL_VAR_REAL; argtype = ECL_VAR_REAL;
...@@ -335,7 +335,7 @@ namespace INMOST ...@@ -335,7 +335,7 @@ namespace INMOST
{ {
assert(have_dimens); assert(have_dimens);
if( xyz.empty() ) xyz.resize(2*(dims[0]+1)*(dims[1]+1)); if( xyz.empty() ) xyz.resize(2*(dims[0]+1)*(dims[1]+1));
read_arrayf = xyz.data(); read_arrayf = xyz.empty() ? NULL : &xyz[0];
numrecs = 1; numrecs = 1;
downread = totread = 2*(dims[0]+1)*(dims[1]+1); downread = totread = 2*(dims[0]+1)*(dims[1]+1);
argtype = ECL_VAR_REAL; argtype = ECL_VAR_REAL;
...@@ -346,7 +346,7 @@ namespace INMOST ...@@ -346,7 +346,7 @@ namespace INMOST
{ {
assert(have_dimens); assert(have_dimens);
if( zcorn.empty() ) zcorn.resize(dims[0]*dims[1]*dims[2]*8); if( zcorn.empty() ) zcorn.resize(dims[0]*dims[1]*dims[2]*8);
read_arrayf = zcorn.data(); read_arrayf = zcorn.empty() ? NULL : &zcorn[0];
numrecs = 1; numrecs = 1;
downread = totread = dims[0]*dims[1]*dims[2]*8; downread = totread = dims[0]*dims[1]*dims[2]*8;
argtype = ECL_VAR_REAL; argtype = ECL_VAR_REAL;
...@@ -356,7 +356,7 @@ namespace INMOST ...@@ -356,7 +356,7 @@ namespace INMOST
{ {
assert(have_dimens); assert(have_dimens);
tops.resize(dims[0]*dims[1]*dims[2]); tops.resize(dims[0]*dims[1]*dims[2]);
read_arrayf = tops.data(); read_arrayf = tops.empty() ? NULL : &tops[0];
numrecs = 1; numrecs = 1;
downread = totread = dims[0]*dims[1]*dims[2]; downread = totread = dims[0]*dims[1]*dims[2];
argtype = ECL_VAR_REAL; argtype = ECL_VAR_REAL;
...@@ -367,7 +367,7 @@ namespace INMOST ...@@ -367,7 +367,7 @@ namespace INMOST
{ {
assert(have_dimens); assert(have_dimens);
if( perm.empty() ) perm.resize(3*dims[0]*dims[1]*dims[2]); if( perm.empty() ) perm.resize(3*dims[0]*dims[1]*dims[2]);
read_arrayf = perm.data(); read_arrayf = perm.empty() ? NULL : &perm[0];
numrecs = 3; numrecs = 3;
downread = totread = dims[0]*dims[1]*dims[2]; downread = totread = dims[0]*dims[1]*dims[2];
argtype = ECL_VAR_REAL; argtype = ECL_VAR_REAL;
...@@ -377,7 +377,7 @@ namespace INMOST ...@@ -377,7 +377,7 @@ namespace INMOST
{ {
assert(have_dimens); assert(have_dimens);
if( perm.empty() ) perm.resize(3*dims[0]*dims[1]*dims[2]); if( perm.empty() ) perm.resize(3*dims[0]*dims[1]*dims[2]);
read_arrayf = perm.data(); read_arrayf = perm.empty() ? NULL : &perm[0];
numrecs = 3; numrecs = 3;
downread = totread = dims[0]*dims[1]*dims[2]; downread = totread = dims[0]*dims[1]*dims[2];
argtype = ECL_VAR_REAL; argtype = ECL_VAR_REAL;
...@@ -388,7 +388,7 @@ namespace INMOST ...@@ -388,7 +388,7 @@ namespace INMOST
{ {
assert(have_dimens); assert(have_dimens);
if( perm.empty() ) perm.resize(3*dims[0]*dims[1]*dims[2]); if( perm.empty() ) perm.resize(3*dims[0]*dims[1]*dims[2]);
read_arrayf = perm.data(); read_arrayf = perm.empty() ? NULL : &perm[0];
numrecs = 3; numrecs = 3;
downread = totread = dims[0]*dims[1]*dims[2]; downread = totread = dims[0]*dims[1]*dims[2];
argtype = ECL_VAR_REAL; argtype = ECL_VAR_REAL;
...@@ -399,7 +399,7 @@ namespace INMOST ...@@ -399,7 +399,7 @@ namespace INMOST
{ {
assert(have_dimens); assert(have_dimens);
poro.resize(3*dims[0]*dims[1]*dims[2]); poro.resize(3*dims[0]*dims[1]*dims[2]);
read_arrayf = poro.data(); read_arrayf = poro.empty() ? NULL : &poro[0];
numrecs = 1; numrecs = 1;
downread = totread = dims[0]*dims[1]*dims[2]; downread = totread = dims[0]*dims[1]*dims[2];
argtype = ECL_VAR_REAL; argtype = ECL_VAR_REAL;
...@@ -3369,10 +3369,10 @@ read_elem_num_link: ...@@ -3369,10 +3369,10 @@ read_elem_num_link:
char set_name[4096]; char set_name[4096];
HandleType * elem_links[4] = HandleType * elem_links[4] =
{ {
new_nodes.data(), new_nodes.empty() ? NULL : &new_nodes[0],
new_edges.data(), new_edges.empty() ? NULL : &new_edges[0],
new_faces.data(), new_faces.empty() ? NULL : &new_faces[0],
new_cells.data() new_cells.empty() ? NULL : &new_cells[0]
}; };
bool low_conn_have_sets = false; bool low_conn_have_sets = false;
bool high_conn_have_sets = false; bool high_conn_have_sets = false;
...@@ -3462,11 +3462,11 @@ read_elem_num_link: ...@@ -3462,11 +3462,11 @@ read_elem_num_link:
}; };
HandleType * elem_links[6] = HandleType * elem_links[6] =
{ {
new_nodes.data(), new_nodes.empty() ? NULL : &new_nodes[0],
new_edges.data(), new_edges.empty() ? NULL : &new_edges[0],
new_faces.data(), new_faces.empty() ? NULL : &new_faces[0],
new_cells.data(), new_cells.empty() ? NULL : &new_cells[0],
new_sets.data(), new_sets.empty() ? NULL : &new_sets[0],
&m_storage &m_storage
}; };
for(INMOST_DATA_ENUM_TYPE j = 0; j < tags.size(); j++) for(INMOST_DATA_ENUM_TYPE j = 0; j < tags.size(); j++)
...@@ -3545,7 +3545,7 @@ read_elem_num_link: ...@@ -3545,7 +3545,7 @@ read_elem_num_link:
INMOST_DATA_ENUM_TYPE numprocs = GetProcessorsNumber(), size = static_cast<INMOST_DATA_ENUM_TYPE>(myprocs.size()),k; INMOST_DATA_ENUM_TYPE numprocs = GetProcessorsNumber(), size = static_cast<INMOST_DATA_ENUM_TYPE>(myprocs.size()),k;
INMOST_DATA_ENUM_TYPE procs_sum = 0; INMOST_DATA_ENUM_TYPE procs_sum = 0;
std::vector<INMOST_DATA_ENUM_TYPE> procs_sizes(numprocs); std::vector<INMOST_DATA_ENUM_TYPE> procs_sizes(numprocs);
REPORT_MPI(MPI_Allgather(&size,1,INMOST_MPI_DATA_ENUM_TYPE,procs_sizes.data(),1,INMOST_MPI_DATA_ENUM_TYPE,GetCommunicator())); REPORT_MPI(MPI_Allgather(&size,1,INMOST_MPI_DATA_ENUM_TYPE,&procs_sizes[0],1,INMOST_MPI_DATA_ENUM_TYPE,GetCommunicator()));
for(k = 0; k < numprocs; k++) if( procs_sizes[k] > 1 ) restore_state = true; for(k = 0; k < numprocs; k++) if( procs_sizes[k] > 1 ) restore_state = true;
REPORT_VAL("restore_state",restore_state); REPORT_VAL("restore_state",restore_state);
if( restore_state ) //we have to do something with parallel status data if( restore_state ) //we have to do something with parallel status data
...@@ -3565,7 +3565,7 @@ read_elem_num_link: ...@@ -3565,7 +3565,7 @@ read_elem_num_link:
displs[k] = displs[k-1]+recvcnts[k-1]; displs[k] = displs[k-1]+recvcnts[k-1];
} }
std::vector<INMOST_DATA_ENUM_TYPE> procs(procs_sum); std::vector<INMOST_DATA_ENUM_TYPE> procs(procs_sum);
REPORT_MPI(ierr = MPI_Allgatherv(myprocs.data(),procs_sizes[myrank],INMOST_MPI_DATA_ENUM_TYPE,procs.data(),recvcnts.data(),displs.data(),INMOST_MPI_DATA_ENUM_TYPE,GetCommunicator())); REPORT_MPI(ierr = MPI_Allgatherv(myprocs.data(),procs_sizes[myrank],INMOST_MPI_DATA_ENUM_TYPE,&procs[0],&recvcnts[0],&displs[0],INMOST_MPI_DATA_ENUM_TYPE,GetCommunicator()));
if( ierr != MPI_SUCCESS ) MPI_Abort(GetCommunicator(),-1); if( ierr != MPI_SUCCESS ) MPI_Abort(GetCommunicator(),-1);
//we have to distinguish new elements and old elements //we have to distinguish new elements and old elements
//all new elements with owner in myprocs belong to me //all new elements with owner in myprocs belong to me
......
...@@ -1852,7 +1852,7 @@ namespace INMOST ...@@ -1852,7 +1852,7 @@ namespace INMOST
} }
} }
} }
RemMarkerArray(all_visited.data(),static_cast<enumerator>(all_visited.size()),busy); if( !all_visited.empty() ) RemMarkerArray(&all_visited[0],static_cast<enumerator>(all_visited.size()),busy);
//for(element_set::iterator it = all_visited.begin(); it != all_visited.end(); ++it) RemMarker(*it,busy); //for(element_set::iterator it = all_visited.begin(); it != all_visited.end(); ++it) RemMarker(*it,busy);
ReleaseMarker(busy); ReleaseMarker(busy);
...@@ -2830,7 +2830,7 @@ namespace INMOST ...@@ -2830,7 +2830,7 @@ namespace INMOST
} }
} }
for(integer i = ElementNum(NODE); i <= ElementNum(CELL); i++) for(integer i = ElementNum(NODE); i <= ElementNum(CELL); i++)
RemMarkerArray(selems[i].data(),static_cast<enumerator>(selems[i].size()),pack_tags_mrk); if( !selems[i].empty() ) RemMarkerArray(&selems[i][0],static_cast<enumerator>(selems[i].size()),pack_tags_mrk);
ReleaseMarker(pack_tags_mrk); ReleaseMarker(pack_tags_mrk);
#else #else
(void) all; (void) all;
...@@ -3004,13 +3004,13 @@ namespace INMOST ...@@ -3004,13 +3004,13 @@ namespace INMOST
if( num > 0 ) if( num > 0 )
{ {
low_conn_size.resize(num); low_conn_size.resize(num);
MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,low_conn_size.data(),static_cast<INMOST_MPI_SIZE>(num),INMOST_MPI_DATA_ENUM_TYPE,comm); if( num != 0 ) MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&low_conn_size[0],static_cast<INMOST_MPI_SIZE>(num),INMOST_MPI_DATA_ENUM_TYPE,comm);
temp = 0; temp = 0;
for(INMOST_DATA_ENUM_TYPE i = 0; i < num; i++) temp += low_conn_size[i]; for(INMOST_DATA_ENUM_TYPE i = 0; i < num; i++) temp += low_conn_size[i];
if( temp > 0 ) if( temp > 0 )
{ {
low_conn_nums.resize(temp); low_conn_nums.resize(temp);
MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,low_conn_nums.data(),static_cast<INMOST_MPI_SIZE>(temp),INMOST_MPI_DATA_INTEGER_TYPE,comm); MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&low_conn_nums[0],static_cast<INMOST_MPI_SIZE>(temp),INMOST_MPI_DATA_INTEGER_TYPE,comm);
} }
} }
selems[1].reserve(num); selems[1].reserve(num);
...@@ -3077,13 +3077,13 @@ namespace INMOST ...@@ -3077,13 +3077,13 @@ namespace INMOST
if( num > 0 ) if( num > 0 )
{ {
low_conn_size.resize(num); low_conn_size.resize(num);
if( !buffer.empty() && !low_conn_size.empty() ) MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,low_conn_size.data(),static_cast<INMOST_MPI_SIZE>(num),INMOST_MPI_DATA_ENUM_TYPE,comm); if( !buffer.empty() && !low_conn_size.empty() ) MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&low_conn_size[0],static_cast<INMOST_MPI_SIZE>(num),INMOST_MPI_DATA_ENUM_TYPE,comm);
temp = 0; temp = 0;
for(INMOST_DATA_ENUM_TYPE i = 0; i < num; i++) temp += low_conn_size[i]; for(INMOST_DATA_ENUM_TYPE i = 0; i < num; i++) temp += low_conn_size[i];
if( temp > 0 ) if( temp > 0 )
{ {
low_conn_nums.resize(temp); low_conn_nums.resize(temp);
MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,low_conn_nums.data(),static_cast<INMOST_MPI_SIZE>(temp),INMOST_MPI_DATA_INTEGER_TYPE,comm); MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&low_conn_nums[0],static_cast<INMOST_MPI_SIZE>(temp),INMOST_MPI_DATA_INTEGER_TYPE,comm);
} }
} }
selems[2].reserve(num); selems[2].reserve(num);
...@@ -3149,22 +3149,22 @@ namespace INMOST ...@@ -3149,22 +3149,22 @@ namespace INMOST
if( num > 0 ) if( num > 0 )
{ {
low_conn_size.resize(num); low_conn_size.resize(num);
MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,low_conn_size.data(),static_cast<INMOST_MPI_SIZE>(num),INMOST_MPI_DATA_ENUM_TYPE,comm); if( num != 0 ) MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&low_conn_size[0],static_cast<INMOST_MPI_SIZE>(num),INMOST_MPI_DATA_ENUM_TYPE,comm);
temp = 0; temp = 0;
for(INMOST_DATA_ENUM_TYPE i = 0; i < num; i++) temp += low_conn_size[i]; for(INMOST_DATA_ENUM_TYPE i = 0; i < num; i++) temp += low_conn_size[i];
if( temp > 0 ) if( temp > 0 )
{ {
low_conn_nums.resize(temp); low_conn_nums.resize(temp);
MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,low_conn_nums.data(),static_cast<INMOST_MPI_SIZE>(temp),INMOST_MPI_DATA_INTEGER_TYPE,comm); MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&low_conn_nums[0],static_cast<INMOST_MPI_SIZE>(temp),INMOST_MPI_DATA_INTEGER_TYPE,comm);
} }
high_conn_size.resize(num); high_conn_size.resize(num);
MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,high_conn_size.data(),static_cast<INMOST_MPI_SIZE>(num),INMOST_MPI_DATA_ENUM_TYPE,comm); if( num != 0 ) MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&high_conn_size[0],static_cast<INMOST_MPI_SIZE>(num),INMOST_MPI_DATA_ENUM_TYPE,comm);
temp = 0; temp = 0;
for(INMOST_DATA_ENUM_TYPE i = 0; i < num; i++) temp += high_conn_size[i]; for(INMOST_DATA_ENUM_TYPE i = 0; i < num; i++) temp += high_conn_size[i];
if( temp > 0 ) if( temp > 0 )
{ {
high_conn_nums.resize(temp); high_conn_nums.resize(temp);
MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,high_conn_nums.data(),static_cast<INMOST_MPI_SIZE>(temp),INMOST_MPI_DATA_INTEGER_TYPE,comm); MPI_Unpack(&buffer[0],static_cast<INMOST_MPI_SIZE>(buffer.size()),&position,&high_conn_nums[0],static_cast<INMOST_MPI_SIZE>(temp),INMOST_MPI_DATA_INTEGER_TYPE,comm);
} }
} }
selems[3].reserve(num); selems[3].reserve(num);
...@@ -3270,7 +3270,7 @@ namespace INMOST ...@@ -3270,7 +3270,7 @@ namespace INMOST
} }
for(integer k = ElementNum(NODE); k <= ElementNum(CELL); ++k) for(integer k = ElementNum(NODE); k <= ElementNum(CELL); ++k)
RemMarkerArray(selems[k].data(),static_cast<enumerator>(selems[k].size()),unpack_tags_mrk); if( !selems[k].empty() ) RemMarkerArray(&selems[k][0],static_cast<enumerator>(selems[k].size()),unpack_tags_mrk);
ReleaseMarker(unpack_tags_mrk); ReleaseMarker(unpack_tags_mrk);
time = Timer() - time; time = Timer() - time;
REPORT_STR("unpack tag data"); REPORT_STR("unpack tag data");
...@@ -3937,7 +3937,7 @@ namespace INMOST ...@@ -3937,7 +3937,7 @@ namespace INMOST
all_visited.push_back(*jt); all_visited.push_back(*jt);
} }
} }
RemMarkerArray(all_visited.data(),static_cast<enumerator>(all_visited.size()),busy); if( !all_visited.empty() ) RemMarkerArray(&all_visited[0],static_cast<enumerator>(all_visited.size()),busy);
//for(element_set::iterator it = all_visited.begin(); it != all_visited.end(); ++it) RemMarker(*it,busy); //for(element_set::iterator it = all_visited.begin(); it != all_visited.end(); ++it) RemMarker(*it,busy);
ReleaseMarker(busy); ReleaseMarker(busy);
} }
......
...@@ -1150,13 +1150,13 @@ namespace INMOST ...@@ -1150,13 +1150,13 @@ namespace INMOST
while( !file.eof() && file.getline(str,4096) ) while( !file.eof() && file.getline(str,4096) )
{ {
int k = 0, l; int k = 0, l;
for(k = 0; k < strlen(str); ++k) for(k = 0; k < (int)strlen(str); ++k)
{ {
if( str[k] == ':' ) break; if( str[k] == ':' ) break;
} }
if( k == strlen(str) ) continue; //invalid line if( k == strlen(str) ) continue; //invalid line
l = k+1; l = k+1;
while(l < strlen(str) && isspace(str[l]) ) ++l; while(l < (int)strlen(str) && isspace(str[l]) ) ++l;
if( l == strlen(str) ) continue; //skip empty entry if( l == strlen(str) ) continue; //skip empty entry
if( !strncmp(str,"PETSc",k) ) if( !strncmp(str,"PETSc",k) )
petsc_database_file = std::string(str+l); petsc_database_file = std::string(str+l);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment