Commit edcb846e authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

fix an issue with interval class; clear library warnings of gcc under release

parent a50e903d
......@@ -460,6 +460,7 @@ namespace INMOST
if( delete_entirely )
{
bool flag = false;
(void)flag;
#if !defined(LAZY_SPARSE_ALLOCATION)
bool have_sparse[6] = {false,false,false,false,false,false};
for(int j = 0; j < 6; j++)
......
......@@ -851,9 +851,9 @@ namespace INMOST
public:
void clear()
{
if (beg_index != end_index) delete [] (parray + beg_index);
if (!empty()) delete [] (parray + beg_index);
parray = NULL;
beg_index = end_index = 0;
end_index = beg_index;
}
void swap(interval<IndType, ValType> & other)
{
......@@ -919,15 +919,13 @@ namespace INMOST
}
~interval()
{
if( beg_index != end_index ) delete [] (parray+beg_index);
parray = NULL;
clear();
}
interval & operator =(interval const & other)
{
if( &other != this )
{
IndType old_beg_index = beg_index;
//IndType old_end_index = end_index;
clear();
beg_index = other.beg_index;
end_index = other.end_index;
if( beg_index != end_index )
......@@ -936,18 +934,11 @@ namespace INMOST
#if defined(DEBUGMEM)
if( tmp == NULL ) {std::cout << __FILE__ << ":" << __LINE__ << "allocation returns NULL\n";}
#endif
//std::copy(parray+old_beg_index,parray+old_end_index,tmp);
delete [] (parray+old_beg_index);
parray = static_cast<ValType *>(tmp);
assert(parray != NULL);
parray = parray - beg_index;
std::copy(other.parray+beg_index,other.parray+end_index,parray+beg_index);
}
else
{
delete [] (parray + old_beg_index);
parray = NULL;
}
}
return *this;
}
......@@ -991,20 +982,18 @@ namespace INMOST
#endif
assert(parray_new != NULL);
parray_new = parray_new - beg_index;
//IndType mbeg = beg_index;
IndType mend = std::min(end,end_index);
if( parray )
if( !empty() )
{
//~ std::cout << beg_index << ":" << end_index << " new end " << end << " old ptr " << (void*)parray << " new ptr " << (void *)parray_new << std::endl;
std::copy(parray+beg_index,parray+mend,parray_new+beg_index);
delete [] (parray+beg_index);
clear();
}
if( mend < end ) std::fill(parray_new+mend,parray_new+end,c);
parray = parray_new;
}
else
{
delete [] (parray+beg_index);
parray = NULL;
}
else clear();
end_index = end;
}
......
......@@ -621,7 +621,7 @@ namespace INMOST
Mesh * m = const_cast<Mesh *>(input.GetMeshLink());
ElementArray<Edge> ret(m);
ret.reserve(input.size());
HandleType last;
HandleType last = InvalidHandle();
ret.push_back(input[0]);
HandleType add = InvalidHandle();
const Element::adj_type & lc0 = m->LowConn(input.at(0));
......@@ -778,7 +778,7 @@ namespace INMOST
{
const Storage::real eps = ECL_INTERSECT_EPS;
Point pfind(InvalidHandle(), 0, 0);
Storage::real t1, t2;
Storage::real t1 = -1, t2 = -1;
Storage::real div = (pabeg.x - paend.x)*(pbbeg.y - pbend.y) - (pabeg.y - paend.y)*(pbbeg.x - pbend.x);
if (std::abs(div) < 1.0e-50)
return std::make_pair(-1, -1);
......@@ -1291,7 +1291,7 @@ namespace INMOST
std::cout << __FILE__ << ":" << __LINE__ << " cannot open file " << File << std::endl;
throw BadFileName;
}
double tt;
double tt = 0;
if (verbosity)
{
tt = Timer();
......@@ -1301,7 +1301,8 @@ namespace INMOST
char readline[2048], readlines[2048], *p, *pend, rec[2048], pupper[2048];
int text_end, text_start, state = ECL_NONE, state_from = ECL_NONE, state_incl = ECL_NONE, nchars;
int waitlines = 0;
int have_dimens = 0, totread, downread, numrecs, offset;
int have_dimens = 0, totread = 0, downread = 0, numrecs = 0, offset = 0;
(void)have_dimens;
int gtype = ECL_GTYPE_NONE;
int argtype = ECL_VAR_NONE;
int radial = ECL_GTYPE_NONE;
......@@ -1319,10 +1320,10 @@ namespace INMOST
fault_rec fault_cur;
std::vector<multflt_rec> multflt;
multflt_rec multflt_cur;
time_t start, last;
time_t start = 0, last = 0;
bool have_start = false;
struct tm date_cur;
bool read_start;
bool read_start = false;
std::vector<double> tsteps(1,0.0); //skip first tstep
std::pair<std::string,compdat_rec> compdat_cur;
std::pair<std::string,welspecs_rec> welspecs_cur;
......@@ -3028,7 +3029,7 @@ namespace INMOST
}
else if (gtype == ECL_GTYPE_ZCORN)
{
double ttt;
double ttt = 0;
if (verbosity)
{
tt = Timer();
......@@ -4057,7 +4058,7 @@ namespace INMOST
TagReal transmul;
if (perform_splitting)
split_face = CreateTag("SPLIT_FACE", DATA_REFERENCE, FACE, NONE, 1); //points to edge that should be used to split face
MarkerType split;
MarkerType split = 0;
if (split_degenerate == 2)
transmul = CreateTag("TRANM", DATA_REAL, FACE, FACE, 1);
else if (split_degenerate == 1)
......@@ -4268,7 +4269,7 @@ namespace INMOST
{ { 0, 1, 4, 5 }, { 2, 3, 6, 7 } }, //v-direction face nodes n,p
{ { 0, 1, 2, 3 }, { 4, 5, 6, 7 } } //w-direction face nodes n,p
};
double u[3], L;
double u[3] = {0.,0.,0.}, L;
for (int r = 0; r < 3; ++r)
{
for (int l = 0; l < 4; ++l)
......@@ -4391,7 +4392,7 @@ namespace INMOST
#pragma omp parallel
#endif
{
int i1, j1, k1, i2, j2, k2, cur1, cur2;
int i1 = -1, j1 = -1, k1 = 0, i2 = -1, j2 = -1, k2 = 0, cur1, cur2;
real T1, T2, R1, R2, ntg1, ntg2;
rMatrix A(3,1), D1(3,1), D2(3,1), X1(3,1), XF1(3,1), X2(3,1), XF2(3,1);
#if defined(USE_OMP)
......@@ -4435,7 +4436,7 @@ namespace INMOST
const int nodes[3][4] = {{0,2,4,6},{0,1,4,5},{0,1,2,3}};
int d, s;
int d = -1, s;
if( i1 != i2 ) // this is X-axis
d = 0;
else if( j1 != j2 ) //this is Y-axis
......
......@@ -976,7 +976,7 @@ namespace INMOST
std::vector<HandleType> new_cells;
std::vector<HandleType> new_sets;
INMOST_DATA_ENUM_TYPE size,i,q;
TopologyCheck tmp;
TopologyCheck tmp = 0;
INMOST_DATA_ENUM_TYPE current_dim = GetDimensions();
bool start = false;
......@@ -1138,6 +1138,11 @@ namespace INMOST
undef = uint32_t(~uint32_t(0));
if( sizeof(uint64_t) == uconv.get_source_iByteSize() )
undef = uint64_t(~uint64_t(0));
else
{
std::cout << __FILE__ << ":" << __LINE__ << " Unknown size for enumerator in source file " << uconv.get_source_iByteSize() << std::endl;
undef = (INMOST_DATA_ENUM_TYPE)(~(INMOST_DATA_ENUM_TYPE)(0));
}
if( datalength == undef )
datalength = ENUMUNDEF;
}
......@@ -1579,15 +1584,15 @@ namespace INMOST
if( noderivs.find(tags_name[j]) != noderivs.end() )
noder = true;
Storage::var_array arr = VariableArray(he,tags[j]);
Storage::real val;
Storage::integer ival;
Storage::real val = 0;
Storage::integer ival = 0;
for(k = 0; k < recsize; k++)
{
Sparse::Row & r = arr[k].GetRow();
iconv.read_fValue(in,val);
arr[k].SetValue(val);
iconv.read_iValue(in,ival);
int rend = ival;
Storage::integer rend = ival;
if( noder )
{
for(int l = 0; l < rend; ++l)
......
......@@ -49,7 +49,7 @@ namespace INMOST
void Mesh::LoadPVTK(std::string File)
{
int state = 0, np, nf = 0;
int state = 0, np = 0, nf = 0;
std::string::size_type attrl, ql, qr, l;
//~ if( m_state == Mesh::Serial ) SetCommunicator(INMOST_MPI_COMM_WORLD);
std::string str, tag, attrval, path = "";
......@@ -142,4 +142,4 @@ namespace INMOST
}
}
#endif
\ No newline at end of file
#endif
......@@ -159,7 +159,7 @@ namespace INMOST
int nelems = 0, ntotconns = 0;
bool matchelems = false;
std::vector<HandleType> * elems;
ElementType curtype;
ElementType curtype = NONE;
XMLReader::XMLTag TagElems;
......
......@@ -70,8 +70,8 @@ namespace INMOST
assert( !(_etype & ESET) );
Mesh * mesh = GetMeshLink();
dynarray<HandleType,128> result;
integer conn[4] = {0,0,0,0};
integer myconn, i;
INMOST_DATA_INTEGER_TYPE conn[4] = {0,0,0,0};
INMOST_DATA_INTEGER_TYPE myconn = -1, i;
enumerator ret = 0;
for(ElementType e = NODE, i = 0; e <= CELL; i++, e = e << 1)
......@@ -213,8 +213,8 @@ namespace INMOST
assert( !(_etype & ESET) );
Mesh * mesh = GetMeshLink();
dynarray<HandleType,128> result;
integer conn[4] = {0,0,0,0};
integer myconn, i;
INMOST_DATA_INTEGER_TYPE conn[4] = {0,0,0,0};
INMOST_DATA_INTEGER_TYPE myconn = -1, i;
enumerator ret = 0;
for(ElementType e = NODE, i = 0; e <= CELL; i++, e = e << 1)
......@@ -480,8 +480,8 @@ namespace INMOST
assert( !(_etype & ESET) );
INMOST::Mesh * mesh = GetMeshLink();
ElementArray<Element> result(mesh);
unsigned int conn[4] = {0,0,0,0};
unsigned int myconn, i = 0;
INMOST_DATA_INTEGER_TYPE conn[4] = {0,0,0,0};
INMOST_DATA_INTEGER_TYPE myconn = -1, i = 0;
for(ElementType e = NODE; e <= CELL; e = e << 1)
{
......@@ -614,8 +614,8 @@ namespace INMOST
assert( !(_etype & ESET) );
INMOST::Mesh * mesh = GetMeshLink();
ElementArray<Element> result(mesh);
unsigned int conn[4] = {0,0,0,0};
unsigned int myconn, i = 0;
INMOST_DATA_INTEGER_TYPE conn[4] = {0,0,0,0};
INMOST_DATA_INTEGER_TYPE myconn = -1, i = 0;
for(ElementType e = NODE; e <= CELL; e = e << 1)
{
......
......@@ -1309,7 +1309,7 @@ namespace INMOST
{
assert(GetElementType() == ESET);
Mesh * m = GetMeshLink();
Element::adj_type * lc;
Element::adj_type * lc = NULL;
Element::adj_type & hc = m->HighConn(GetHandle());
if( comp != UNSORTED_COMPARATOR )
lc = &m->LowConn(GetHandle());
......
......@@ -158,6 +158,7 @@ namespace INMOST
#endif
m_link = this;
integer selfid = 1;
(void)selfid;
selfid = TieElement(5);
assert(selfid == 0);
dim = 3;
......@@ -364,6 +365,7 @@ namespace INMOST
#endif
m_link = this;
integer selfid = 1;
(void)selfid;
selfid = TieElement(5);
assert(selfid == 0);
//TagManager constuctor copied only tags
......
......@@ -381,6 +381,7 @@ namespace INMOST
if( unite.empty() ) return Face(m,InvalidHandle());
MarkerType hm = m->HideMarker();
bool doexit = false, dothrow = false;
(void)dothrow;
for(ElementArray<Face>::size_type j = 0; j < unite.size(); j++)
if( m->GetMarker(unite.at(j),del_protect) ) doexit = true;
if( doexit ) return Face(m,InvalidHandle());
......@@ -511,6 +512,7 @@ namespace INMOST
prev = lc[k2];
//find out the next edge connected to the privious node
bool found = false; //detect that edge was found, otherwise there is no loop
(void)found;
adj_type const & hc = m->HighConn(prev);
for(adj_type::size_type it = 0; it < hc.size(); ++it) if( !m->GetMarker(hc[it],hm) )
{
......@@ -666,6 +668,7 @@ namespace INMOST
Mesh * m = const_cast<Mesh *>(unite.GetMeshLink());
if( unite.size() == 0 ) return false;
bool doexit = false, dothrow = false;
(void)dothrow;
for(ElementArray<Face>::size_type j = 0; j < unite.size(); j++)
if( m->GetMarker(unite.at(j),del_protect) ) doexit = true;
MarkerType hm = m->HideMarker();
......@@ -741,6 +744,7 @@ namespace INMOST
if( edges.size() == 0 ) return Edge(m,InvalidHandle());
bool doexit = false, dothrow = false;
(void)dothrow;
MarkerType hm = m->HideMarker();
MarkerType rem = m->CreateMarker();
dynarray<HandleType,64> cells;
......@@ -956,6 +960,7 @@ namespace INMOST
if( edges.empty() ) return false;
Mesh * m = edges.GetMeshLink();
bool doexit = false, dothrow = false;
(void)dothrow;
MarkerType hm = m->HideMarker();
MarkerType rem = m->CreateMarker();
dynarray<HandleType,64> faces;
......
......@@ -3681,6 +3681,7 @@ namespace INMOST
#if defined(USE_MPI)
int mpirank = GetProcessorRank();
int mpisize = GetProcessorsNumber();
(void)mpisize;
//int err = 0;
REPORT_STR("gather ghost and shared elements")
double time = Timer();
......@@ -4571,10 +4572,9 @@ namespace INMOST
{
if( *jt != InvalidHandle() && !Hidden(*jt) && HaveData(*jt,arr_position) )
{
INMOST_DATA_INTEGER_TYPE el_num = GetHandleElementNum(*jt);
assert(HaveData(*jt,arr_position));
assert((size_t)arr_position[*jt] < selems[el_num].size() );
assert(*jt == selems[el_num][arr_position[*jt]]);
assert((size_t)arr_position[*jt] < selems[GetHandleElementNum(*jt)].size() );
assert(*jt == selems[GetHandleElementNum(*jt)][arr_position[*jt]]);
low_conn_nums.push_back(ComposeHandle(GetHandleElementType(*jt),arr_position[*jt]));
low_conn_size[k]++;
}
......@@ -6161,6 +6161,7 @@ namespace INMOST
void Mesh::CheckGhostSharedCount(std::string file, int line, ElementType etype)
{
(void)file,(void)line,(void)etype; //no warning in release
#if !defined(NDEBUG)
ENTER_FUNC();
#if defined(USE_MPI)
......@@ -6224,6 +6225,7 @@ namespace INMOST
void Mesh::CheckProcsSorted(std::string file, int line)
{
(void)file,(void)line;
#if !defined(NDEBUG)
ENTER_FUNC();
int err = 0;
......@@ -6257,6 +6259,7 @@ namespace INMOST
void Mesh::CheckSetLinks(std::string file, int line)
{
(void)file,(void)line;
ENTER_FUNC();
#if !defined(NDEBUG)
Storage::integer err = 0;
......@@ -6284,6 +6287,7 @@ namespace INMOST
void Mesh::CheckCentroids(std::string file, int line)
{
(void)file,(void)line; //no warning
#if !defined(NDEBUG)
ENTER_FUNC();
TagRealArray checker = CreateTag("CHECK_CENTROIDS",DATA_REAL,CELL|FACE|EDGE|NODE,CELL|FACE|EDGE|NODE,3);
......
......@@ -5,7 +5,7 @@
namespace INMOST
{
thread_private<memory_pool> _pool;
static thread_private<memory_pool> _pool;
memory_pool & get_pool()
......
......@@ -403,12 +403,11 @@ using namespace INMOST;
interval<INMOST_DATA_ENUM_TYPE, INMOST_DATA_ENUM_TYPE> Ubeg(mobeg, moend,EOL), Lbeg(mobeg, moend,EOL), Bbeg(mobeg,moend,EOL),Abeg(mobeg,moend,EOL), Fbeg(mobeg,moend,EOL);
//supplimentary data structures for condition estimates of L^{-1}, U^{-1}
#if defined(ESTIMATOR)
INMOST_DATA_REAL_TYPE mup, mum, smup, smum, NuU = 1, NuL = 1, NuD, NuL1 = 1, NuL2 = 1, NuU1 = 1, NuU2 = 1;
INMOST_DATA_REAL_TYPE NuU1_old = 1, NuL1_old = 1, NuU2_old = 1, NuL2_old = 1;
INMOST_DATA_REAL_TYPE NuU1_new, NuU2_new, NuL1_new, NuL2_new, vp, vm, v;
INMOST_DATA_REAL_TYPE NuU1_new = 1, NuU2_new = 1, NuL1_new = 1, NuL2_new = 1, vp, vm, v;
INMOST_DATA_ENUM_TYPE np, nm;
interval<INMOST_DATA_ENUM_TYPE, INMOST_DATA_REAL_TYPE> EstL1(mobeg, moend,0.0), EstU1(mobeg, moend,0.0), CondU(mobeg,moend,1.0);
interval<INMOST_DATA_ENUM_TYPE, INMOST_DATA_REAL_TYPE> EstL2(mobeg, moend,0.0), EstU2(mobeg, moend,0.0), CondL(mobeg,moend,1.0);
......
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