Commit 3e6e483f authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

Fix errors if some cmake options are disabled; make visual studio a bit more happy

parent bdc7a7e5
......@@ -25,3 +25,5 @@ Source/Solver/solver_k3biilu2/k3d_block.hxx
/.vs
/out/install/x64-Release
/CMakeSettings.json
tmp/
......@@ -25,7 +25,7 @@
static std::string NameSlash(std::string input)
{
for(unsigned l = input.size(); l > 0; --l)
for(unsigned l = static_cast<unsigned>(input.size()); l > 0; --l)
if( input[l-1] == '/' || input[l-1] == '\\' )
return std::string(input.c_str() + l);
return input;
......@@ -74,7 +74,7 @@ namespace INMOST
(void) size;
const INMOST_DATA_INTEGER_TYPE * idata = (const INMOST_DATA_INTEGER_TYPE *)data;
Storage::integer_array odata = element->IntegerArray(tag);
std::vector<int> tmp(size+odata.size());
std::vector<int> tmp(static_cast<size_t>(size)+static_cast<size_t>(odata.size()));
tmp.resize(std::set_union(odata.begin(),odata.end(),idata,idata+size,tmp.begin())-tmp.begin());
odata.replace(odata.begin(),odata.end(),tmp.begin(),tmp.end());
}
......@@ -336,7 +336,9 @@ namespace INMOST
AdaptiveMesh::AdaptiveMesh(Mesh & _m) : m(&_m)
{
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
model = NULL;
#endif
//create a tag that stores maximal refinement level of each element
level = m->CreateTag("REFINEMENT_LEVEL",DATA_INTEGER,CELL|FACE|EDGE|NODE|ESET,NONE,1);
//tag_status = m->CreateTag("TAG_STATUS",DATA_INTEGER,CELL|FACE|EDGE|NODE,NONE,1);
......@@ -617,9 +619,9 @@ namespace INMOST
ElementArray<Edge> new_edges = Edge::SplitEdge(e,ElementArray<Node>(m,1,n.GetHandle()),0);
//set increased level for new edges
level[new_edges[0]] = level[new_edges[1]] = level[e]+1;
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->EdgeRefinement(e,new_edges);
#endif
//for(int q = 0; q < 2; ++q)
//{
// REPORT_STR("new edges["<<q<<"]" << new_edges[q].LocalID() << " nodes " << new_edges[q].getBeg().LocalID() << "," << new_edges[q].getEnd().LocalID() << " level " << level[new_edges[q]]);
......@@ -706,7 +708,9 @@ namespace INMOST
//set increased level to new faces
for(ElementArray<Face>::size_type kt = 0; kt < new_faces.size(); ++kt)
level[new_faces[kt]] = level[f]+1;
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->FaceRefinement(f,new_faces);
#endif
}
}
EXIT_BLOCK();
......@@ -861,7 +865,7 @@ namespace INMOST
//set up increased level for the new cells
for(ElementArray<Cell>::size_type kt = 0; kt < new_cells.size(); ++kt)
{
set_id[new_cells[kt]] = kt;
set_id[new_cells[kt]] = (int)kt;
level[new_cells[kt]] = level[c]+1;
cell_set.PutElement(new_cells[kt]);
parent_set[new_cells[kt]] = cell_set.GetHandle();
......@@ -877,8 +881,9 @@ namespace INMOST
*/
//if( !cell_set->HaveParent() )
parent.AddChild(cell_set);
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->CellRefinement(c,new_cells);
#endif
//else assert(cell_set->GetParent() == parent);
//increment number of refined cells
ret++;
......@@ -903,7 +908,9 @@ namespace INMOST
//ExchangeGhost(3,NODE); // Construct Ghost cells in 2 layers connected via nodes
//12. Let the user update their data
//todo: call back function for New( cells
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->Adaptation(*m);
#endif
m->CheckSetLinks(__FILE__,__LINE__);
//13. Delete old elements of the mesh
m->ApplyModification();
......@@ -1465,8 +1472,9 @@ namespace INMOST
ElementSet(m,parent_set[v]).PutElement(v);
//set level for new cell
level[v] = level[c]-1;
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->CellCoarsening(unite_cells,v);
#endif
//~ v.Centroid(x);
//fout << v.GlobalID() << " lid " << v.LocalID();
//fout << " parent " << ElementSet(m,parent_set[v]).GetName();
......@@ -1529,8 +1537,9 @@ namespace INMOST
hanging_nodes[v].push_back(hanging[lt]);
visited = true;
numcoarsened++;
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->FaceCoarsening(unite_faces,v);
#endif
break; //no need to visit the other cell
}
}
......@@ -1569,8 +1578,9 @@ namespace INMOST
//set level for new edge
level[v] = level[e]-1;
visited = true;
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->EdgeCoarsening(unite_edges,v);
#endif
break; //no need to visit any other face
}
}
......@@ -1601,7 +1611,9 @@ namespace INMOST
m->ResolveModification();
//todo:
//let the user update their data
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->Adaptation(*m);
#endif
m->ApplyModification();
//done
m->EndModification();
......@@ -1730,7 +1742,7 @@ namespace INMOST
Storage::reference_array hanging = hanging_nodes[*jt];
nodes.Subtract(hanging.data(),hanging.size());
}
wgt[*it] = nodes.size();
wgt[*it] = (INMOST_DATA_REAL_TYPE)nodes.size();
}
else wgt[*it] = 0;
}
......
......@@ -7,7 +7,9 @@ namespace INMOST
class AdaptiveMesh
{
Mesh * m;
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
Model * model;
#endif
ElementSet root; //< Root set that links all the other sets for coarsements
//TagInteger tag_status;
TagInteger set_id;
......@@ -36,7 +38,9 @@ namespace INMOST
/// Delete all data related to mesh refinement-coarsement.
void ClearData();
void PrintSet(std::ostream & fout, ElementSet set);
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
void SetModel(Model * mm) {model = mm;}
#endif
//the work on each cell is supposed to be proportional to the number of cells refined
//this number is equal to number of original nodes
void ComputeWeightRefine(TagInteger indicator, TagReal weight);
......
......@@ -5,8 +5,10 @@ if (USE_MESH)
add_subdirectory(GridGen)
add_subdirectory(GridTools)
endif (USE_MESH)
if (USE_OPTIMIZER)
if (USE_OPTIMIZER AND USE_SOLVER)
add_subdirectory(OptimizerSolve)
endif ()
if (USE_OPTIMIZER)
add_subdirectory(OptimizerFunction)
endif ()
if (USE_SOLVER)
......
......@@ -158,7 +158,11 @@ int main(int argc, char *argv[])
{
//if( *t == m1.CoordsTag() ) continue;
//if( t->GetSize() == ENUMUNDEF ) continue;
if( t->GetDataType() != DATA_REAL && t->GetDataType() != DATA_VARIABLE ) continue;
if( t->GetDataType() != DATA_REAL
#if defined(USE_AUTODIFF)
&& t->GetDataType() != DATA_VARIABLE
#endif
) continue;
if( m2.HaveTag(t->GetTagName()) )
{
Tag t2 = m2.GetTag(t->GetTagName());
......@@ -227,6 +231,7 @@ int main(int argc, char *argv[])
Lvol += vol;
}
}
#if defined(USE_AUTODIFF)
else if( t->GetDataType() == DATA_VARIABLE )
{
Storage::var_array arr1 = c1->VariableArray(*t);
......@@ -257,6 +262,7 @@ int main(int argc, char *argv[])
Lvol += vol;
}
}
#endif
}
}
if( diff_size ) std::cout << "Size is different on " << diff_size << " / " << tot_size << " of " << ElementTypeName(etype) << std::endl;
......
......@@ -204,7 +204,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::real_array source = it->RealArray(transfer_node_real_tags[q]);
Storage::real_array target = image->RealArray(transfer_node_real_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
......@@ -214,7 +214,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::integer_array source = it->IntegerArray(transfer_node_integer_tags[q]);
Storage::integer_array target = image->IntegerArray(transfer_node_integer_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
......@@ -328,7 +328,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::real_array source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = f.first->RealArray(transfer_face_real_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q)
......@@ -337,7 +337,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::integer_array source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = f.first->IntegerArray(transfer_face_integer_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
......@@ -433,7 +433,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::real_array source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = facesb.first->RealArray(transfer_face_real_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q)
......@@ -442,7 +442,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::integer_array source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = facesb.first->IntegerArray(transfer_face_integer_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
}
......@@ -490,7 +490,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::real_array source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = facesf.first->RealArray(transfer_face_real_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q)
......@@ -499,7 +499,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::integer_array source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = facesf.first->IntegerArray(transfer_face_integer_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
}
......@@ -825,7 +825,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::real_array source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = f.first->RealArray(transfer_face_real_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q)
......@@ -834,7 +834,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::integer_array source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = f.first->IntegerArray(transfer_face_integer_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
}
......@@ -911,7 +911,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::real_array source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = facesb.first->RealArray(transfer_face_real_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q)
......@@ -920,7 +920,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::integer_array source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = facesb.first->IntegerArray(transfer_face_integer_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
}
......@@ -954,7 +954,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::real_array source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = facesf.first->RealArray(transfer_face_real_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q)
......@@ -963,7 +963,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier)
Storage::integer_array source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = facesf.first->IntegerArray(transfer_face_integer_tags[q]);
if( target.size() != source.size() ) target.resize(source.size());
for(int qq = 0; qq < source.size(); ++qq)
for(INMOST_DATA_ENUM_TYPE qq = 0; qq < source.size(); ++qq)
target[qq] = source[qq];
}
}
......
......@@ -83,6 +83,7 @@ int main(int argc, char ** argv)
else if( comp < oarr.size() ) std::cout << oarr[comp] << "; ";
else std::cout << "NAN; ";
}
#if defined(USE_AUTODIFF)
else if( otag.GetDataType() == DATA_VARIABLE )
{
Storage::var_array oarr = it->VariableArray(otag);
......@@ -90,6 +91,7 @@ int main(int argc, char ** argv)
else if( comp < oarr.size() ) std::cout << get_value(oarr[comp]) << "; ";
else std::cout << "NAN; ";
}
#endif
else if( otag.GetDataType() == DATA_INTEGER )
{
Storage::integer_array oarr = it->IntegerArray(otag);
......
......@@ -60,8 +60,8 @@ void init2d(double * arr, int N, double mint, double maxt)
double intrp2d(double * arr, int N, double x, double y)
{
int n = ceil(x*(N-1));
int m = ceil(y*(N-1));
int n = static_cast<int>(ceil(x*(N-1)));
int m = static_cast<int>(ceil(y*(N-1)));
if( n == 0 ) n = 1;
if( m == 0 ) m = 1;
double dh = 1.0/(double)(N-1);
......@@ -154,7 +154,7 @@ void SetLayers::DeformLayers(double coef)
c->Centroid(cnt);
for(int d = 0; d < 3; ++d)
cc[d] = (cnt[d]-cmin[d])/(cmax[d]-cmin[d]);
std::pair<int,double> lc = layer1d(&layers_z[0],layers_z.size()-1,cc[2]);
std::pair<int,double> lc = layer1d(&layers_z[0],static_cast<int>(layers_z.size())-1,cc[2]);
layer_tag[*c] = lc.first;
coef_tag[*c] = lc.second;
......@@ -164,7 +164,7 @@ void SetLayers::DeformLayers(double coef)
double c[3] = {0,0,0};
for(int d = 0; d < 3; ++d)
c[d] = (n->Coords()[d]-cmin[d])/(cmax[d]-cmin[d]);
std::pair<int,double> lc = layer1d(&layers_z[0],layers_z.size()-1,c[2]);
std::pair<int,double> lc = layer1d(&layers_z[0],static_cast<int>(layers_z.size())-1,c[2]);
if( lc.first == -1 ) std::cout << "layer not found for " << c[0] << "," << c[1] << "," << c[2] << " node " << n->LocalID() << std::endl;
double h = 0;
......
......@@ -3,6 +3,9 @@
//
#include "dynamic_r2.h"
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
DynamicR2::DynamicR2() : distribution(-0.04, 0.04) {
unsigned int seed = static_cast<unsigned int>(time(NULL));
......
......@@ -5,6 +5,9 @@
#include "static_sin.h"
#include <cmath>
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
double StaticSin::invoke(double x, double y, int iteration) const noexcept {
return 1.0 - std::sin(x);
......
......@@ -5,6 +5,9 @@
#include "static_sin_r2.h"
#include <cmath>
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
double StaticSinR2::invoke(double x, double y, int iteration) const noexcept {
return -1.0 * std::sin(x) * std::cos(y) + 1.0;
......
......@@ -184,7 +184,7 @@ int main(int argc, char **argv) {
Solver solver = Solver(solverName, "test");
solver.SetVerbosityLevel(SolverVerbosityLevel::Level0);
solver.SetVerbosityLevel(SolverVerbosityLevel::SolverVerbosityLevel0);
solver.SetParameter("eps", "1e-12");
if (rank == 0) std::cout << "Solving with " << solverName << std::endl;
......
......@@ -10,13 +10,13 @@
// trim from start
static inline std::string &ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
s.erase(s.find_last_not_of(" \t\n\r\f\v") + 1);
return s;
}
// trim from end
static inline std::string &rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
s.erase(s.find_last_not_of(" \t\n\r\f\v") + 1);
return s;
}
......
......@@ -11,13 +11,12 @@
namespace INMOST
{
#if defined(USE_MESH) //Automatizator class does not exist without mesh
template<> Demote<INMOST_DATA_REAL_TYPE>::type AbstractEntry::Access<INMOST_DATA_REAL_TYPE> (const Storage& e, INMOST_DATA_ENUM_TYPE pos) const {return Value(e,pos);}
template<> Demote<INMOST_DATA_INTEGER_TYPE>::type AbstractEntry::Access<INMOST_DATA_INTEGER_TYPE>(const Storage& e, INMOST_DATA_ENUM_TYPE pos) const {return Index(e,pos);}
template<> Demote<unknown>::type AbstractEntry::Access<unknown> (const Storage& e, INMOST_DATA_ENUM_TYPE pos) const {return Unknown(e,pos);}
template<> Demote<variable>::type AbstractEntry::Access<variable> (const Storage& e, INMOST_DATA_ENUM_TYPE pos) const {return Unknown(e,pos);}
template<> Demote<hessian_variable>::type AbstractEntry::Access<hessian_variable> (const Storage& e, INMOST_DATA_ENUM_TYPE pos) const {return Unknown(e,pos);}
template<>
Matrix<Demote<INMOST_DATA_REAL_TYPE>::type, pool_array_t<Demote<INMOST_DATA_REAL_TYPE>::type> >
AbstractEntry::Access<INMOST_DATA_REAL_TYPE> (const Storage& e) const {return Value(e);}
......@@ -35,7 +34,6 @@ namespace INMOST
AbstractEntry::Access<hessian_variable>(const Storage& e) const {return Unknown(e);}
#if defined(USE_MESH) //Automatizator class does not exist without mesh
Automatizator * Automatizator::CurrentAutomatizator = NULL;
bool print_ad_ctor = false;
bool GetAutodiffPrint() {return print_ad_ctor;}
......
......@@ -337,10 +337,10 @@ namespace INMOST
max_err = block_err;
}
int_err += block_err*block_err;
int N = err.Rows()*err.Cols();
INMOST_DATA_ENUM_TYPE N = err.Rows()*err.Cols();
if( N > it->second->Size() ) continue; //No account for variable size
//~ std::cout << jt->LocalID() << " block err " << block_err << " comp err ";
for(int k = 0; k < N; ++k)
for(INMOST_DATA_ENUM_TYPE k = 0; k < N; ++k)
{
//~ std::cout << err.data()[k] << " ";
err_int[k] += err.data()[k]*err.data()[k];
......
......@@ -265,7 +265,7 @@ namespace INMOST
#endif
m_arr = static_cast<element *>(tmp);
assert(m_arr != NULL);
memcpy(m_arr,other.m_arr,sizeof(element)*m_size);
if( m_arr ) memcpy(m_arr,other.m_arr,sizeof(element)*m_size);
}
}
return *this;
......@@ -740,28 +740,20 @@ namespace INMOST
public:
__INLINE element * data() {return *m_arr;}
__INLINE const element * data() const {return *m_arr;}
shell() {m_arr = NULL; m_size = NULL; fixed = false;}
shell() :local_link(NULL), local_size(0), m_arr(NULL), m_size(NULL), fixed(false) { }
shell(array<element> & arr) //dynamic
{
m_arr = &arr.m_arr;
m_size = &arr.m_size;
fixed = false;
}
:local_link(NULL), local_size(0), m_arr(&arr.m_arr), m_size(&arr.m_size), fixed(false) {}
shell(element * link, size_type size) //fixed
:local_link(NULL),local_size(0), m_arr(&local_link), m_size(&local_size), fixed(true)
{
m_arr = &local_link;
*m_arr = link;
m_size = &local_size;
*m_size = size;
fixed = true;
}
shell(const shell & other)
:local_link(NULL), local_size(0), m_arr(&local_link), m_size(&local_size),fixed(other.fixed)
{
fixed = other.fixed;
if( fixed )
{
m_size = &local_size;
m_arr = &local_link;
*m_size = *other.m_size;
*m_arr = *other.m_arr;
}
......@@ -1982,18 +1974,18 @@ namespace INMOST
}
*/
}
dynarray()
dynarray() : stack()
{
pbegin = pend = stack;
preserved = stack+static_cast<size_type>(stacked);
}
dynarray(size_type n,element c = element())
dynarray(size_type n,element c = element()) : stack()
{
preallocate(n);
for(element * i = pbegin; i < pend; i++) new (i) element(c);
}
template<class InputIterator>
dynarray(InputIterator first, InputIterator last)
dynarray(InputIterator first, InputIterator last) : stack()
{
size_type n = static_cast<size_type>(std::distance(first,last));
preallocate(n);
......@@ -2016,7 +2008,7 @@ namespace INMOST
{
if( pbegin != stack )
{
for(element * i = pbegin; i < pend; i++) (*i).~element();
for(element * i = pbegin; i < pend; i++) i->~element();
free(pbegin);
}
}
......@@ -2025,7 +2017,7 @@ namespace INMOST
if( this != &other )
{
size_type n = size();
for(element * i = pbegin; i != pend; ++i) (*i).~element();
for(element * i = pbegin; i != pend; ++i) i->~element();
if(pbegin != stack) free(pbegin);
n = other.size();
preallocate(n);
......
......@@ -173,7 +173,7 @@ namespace INMOST
INMOST_DATA_ENUM_TYPE unknown_comp;
public:
///Default constructor.
SingleEntry(ElementType etype = NONE, MarkerType mask = 0, bool inverse = false) : AbstractEntry(etype,mask,inverse) {}
SingleEntry(ElementType etype = NONE, MarkerType mask = 0, bool inverse = false) : AbstractEntry(etype, mask, inverse) { unknown_comp = 0; }
///Constructor with tag.
SingleEntry(ElementType etype, MarkerType mask, bool inverse, Tag unknown_tag, INMOST_DATA_ENUM_TYPE unknown_comp = 0) : AbstractEntry(etype,mask,inverse), unknown_tag(unknown_tag), unknown_comp(unknown_comp) {}
///Provide tag.
......
......@@ -378,7 +378,7 @@ namespace INMOST
{
Mesh * m;
public:
reverse_iterator() :shell<HandleType>::reverse_iterator() {}
reverse_iterator() :shell<HandleType>::reverse_iterator(), m(NULL) {}
reverse_iterator(Mesh * m, const shell<HandleType>::reverse_iterator & other) : shell<HandleType>::reverse_iterator(other), m(m) {}
reverse_iterator(const reverse_iterator & other) : shell<HandleType>::reverse_iterator(other), m(other.m) {}
reverse_iterator & operator =(reverse_iterator const & other) {m = other.m; shell<HandleType>::reverse_iterator::operator=(other); return *this;}
......@@ -392,7 +392,7 @@ namespace INMOST
{
Mesh * m;
public:
const_reverse_iterator() :shell<HandleType>::const_reverse_iterator() {}
const_reverse_iterator() :shell<HandleType>::const_reverse_iterator(), m(NULL) {}
const_reverse_iterator(Mesh * m, const shell<HandleType>::const_reverse_iterator & other) : shell<HandleType>::const_reverse_iterator(other), m(m) {}
const_reverse_iterator(const const_reverse_iterator & other) : shell<HandleType>::const_reverse_iterator(other), m(other.m) {}
const_reverse_iterator & operator =(const_reverse_iterator const & other) {m = other.m; shell<HandleType>::const_reverse_iterator::operator=(other); return *this;}
......
......@@ -3535,16 +3535,16 @@ namespace INMOST
}
void bubbleDown(INMOST_DATA_ENUM_TYPE k)
{
INMOST_DATA_ENUM_TYPE j;
size_t j;
while(2*k <= size)
{
j = 2*k;
j = 2*static_cast<size_t>(k);
if(j < size && keys[heap[j]] > keys[heap[j+1]])
j++;
if(keys[heap[k]] <= keys[heap[j]])