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 ...@@ -25,3 +25,5 @@ Source/Solver/solver_k3biilu2/k3d_block.hxx
/.vs /.vs
/out/install/x64-Release /out/install/x64-Release
/CMakeSettings.json /CMakeSettings.json
tmp/
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
static std::string NameSlash(std::string input) 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] == '\\' ) if( input[l-1] == '/' || input[l-1] == '\\' )
return std::string(input.c_str() + l); return std::string(input.c_str() + l);
return input; return input;
...@@ -74,7 +74,7 @@ namespace INMOST ...@@ -74,7 +74,7 @@ namespace INMOST
(void) size; (void) size;
const INMOST_DATA_INTEGER_TYPE * idata = (const INMOST_DATA_INTEGER_TYPE *)data; const INMOST_DATA_INTEGER_TYPE * idata = (const INMOST_DATA_INTEGER_TYPE *)data;
Storage::integer_array odata = element->IntegerArray(tag); 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()); 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()); odata.replace(odata.begin(),odata.end(),tmp.begin(),tmp.end());
} }
...@@ -336,7 +336,9 @@ namespace INMOST ...@@ -336,7 +336,9 @@ namespace INMOST
AdaptiveMesh::AdaptiveMesh(Mesh & _m) : m(&_m) AdaptiveMesh::AdaptiveMesh(Mesh & _m) : m(&_m)
{ {
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
model = NULL; model = NULL;
#endif
//create a tag that stores maximal refinement level of each element //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); 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); //tag_status = m->CreateTag("TAG_STATUS",DATA_INTEGER,CELL|FACE|EDGE|NODE,NONE,1);
...@@ -617,9 +619,9 @@ namespace INMOST ...@@ -617,9 +619,9 @@ namespace INMOST
ElementArray<Edge> new_edges = Edge::SplitEdge(e,ElementArray<Node>(m,1,n.GetHandle()),0); ElementArray<Edge> new_edges = Edge::SplitEdge(e,ElementArray<Node>(m,1,n.GetHandle()),0);
//set increased level for new edges //set increased level for new edges
level[new_edges[0]] = level[new_edges[1]] = level[e]+1; 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); if( model ) model->EdgeRefinement(e,new_edges);
#endif
//for(int q = 0; q < 2; ++q) //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]]); // 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 ...@@ -706,7 +708,9 @@ namespace INMOST
//set increased level to new faces //set increased level to new faces
for(ElementArray<Face>::size_type kt = 0; kt < new_faces.size(); ++kt) for(ElementArray<Face>::size_type kt = 0; kt < new_faces.size(); ++kt)
level[new_faces[kt]] = level[f]+1; level[new_faces[kt]] = level[f]+1;
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->FaceRefinement(f,new_faces); if( model ) model->FaceRefinement(f,new_faces);
#endif
} }
} }
EXIT_BLOCK(); EXIT_BLOCK();
...@@ -861,7 +865,7 @@ namespace INMOST ...@@ -861,7 +865,7 @@ namespace INMOST
//set up increased level for the new cells //set up increased level for the new cells
for(ElementArray<Cell>::size_type kt = 0; kt < new_cells.size(); ++kt) 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; level[new_cells[kt]] = level[c]+1;
cell_set.PutElement(new_cells[kt]); cell_set.PutElement(new_cells[kt]);
parent_set[new_cells[kt]] = cell_set.GetHandle(); parent_set[new_cells[kt]] = cell_set.GetHandle();
...@@ -877,8 +881,9 @@ namespace INMOST ...@@ -877,8 +881,9 @@ namespace INMOST
*/ */
//if( !cell_set->HaveParent() ) //if( !cell_set->HaveParent() )
parent.AddChild(cell_set); parent.AddChild(cell_set);
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->CellRefinement(c,new_cells); if( model ) model->CellRefinement(c,new_cells);
#endif
//else assert(cell_set->GetParent() == parent); //else assert(cell_set->GetParent() == parent);
//increment number of refined cells //increment number of refined cells
ret++; ret++;
...@@ -903,7 +908,9 @@ namespace INMOST ...@@ -903,7 +908,9 @@ namespace INMOST
//ExchangeGhost(3,NODE); // Construct Ghost cells in 2 layers connected via nodes //ExchangeGhost(3,NODE); // Construct Ghost cells in 2 layers connected via nodes
//12. Let the user update their data //12. Let the user update their data
//todo: call back function for New( cells //todo: call back function for New( cells
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->Adaptation(*m); if( model ) model->Adaptation(*m);
#endif
m->CheckSetLinks(__FILE__,__LINE__); m->CheckSetLinks(__FILE__,__LINE__);
//13. Delete old elements of the mesh //13. Delete old elements of the mesh
m->ApplyModification(); m->ApplyModification();
...@@ -1465,8 +1472,9 @@ namespace INMOST ...@@ -1465,8 +1472,9 @@ namespace INMOST
ElementSet(m,parent_set[v]).PutElement(v); ElementSet(m,parent_set[v]).PutElement(v);
//set level for new cell //set level for new cell
level[v] = level[c]-1; level[v] = level[c]-1;
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->CellCoarsening(unite_cells,v); if( model ) model->CellCoarsening(unite_cells,v);
#endif
//~ v.Centroid(x); //~ v.Centroid(x);
//fout << v.GlobalID() << " lid " << v.LocalID(); //fout << v.GlobalID() << " lid " << v.LocalID();
//fout << " parent " << ElementSet(m,parent_set[v]).GetName(); //fout << " parent " << ElementSet(m,parent_set[v]).GetName();
...@@ -1529,8 +1537,9 @@ namespace INMOST ...@@ -1529,8 +1537,9 @@ namespace INMOST
hanging_nodes[v].push_back(hanging[lt]); hanging_nodes[v].push_back(hanging[lt]);
visited = true; visited = true;
numcoarsened++; numcoarsened++;
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->FaceCoarsening(unite_faces,v); if( model ) model->FaceCoarsening(unite_faces,v);
#endif
break; //no need to visit the other cell break; //no need to visit the other cell
} }
} }
...@@ -1569,8 +1578,9 @@ namespace INMOST ...@@ -1569,8 +1578,9 @@ namespace INMOST
//set level for new edge //set level for new edge
level[v] = level[e]-1; level[v] = level[e]-1;
visited = true; visited = true;
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->EdgeCoarsening(unite_edges,v); if( model ) model->EdgeCoarsening(unite_edges,v);
#endif
break; //no need to visit any other face break; //no need to visit any other face
} }
} }
...@@ -1601,7 +1611,9 @@ namespace INMOST ...@@ -1601,7 +1611,9 @@ namespace INMOST
m->ResolveModification(); m->ResolveModification();
//todo: //todo:
//let the user update their data //let the user update their data
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
if( model ) model->Adaptation(*m); if( model ) model->Adaptation(*m);
#endif
m->ApplyModification(); m->ApplyModification();
//done //done
m->EndModification(); m->EndModification();
...@@ -1730,7 +1742,7 @@ namespace INMOST ...@@ -1730,7 +1742,7 @@ namespace INMOST
Storage::reference_array hanging = hanging_nodes[*jt]; Storage::reference_array hanging = hanging_nodes[*jt];
nodes.Subtract(hanging.data(),hanging.size()); nodes.Subtract(hanging.data(),hanging.size());
} }
wgt[*it] = nodes.size(); wgt[*it] = (INMOST_DATA_REAL_TYPE)nodes.size();
} }
else wgt[*it] = 0; else wgt[*it] = 0;
} }
......
...@@ -7,7 +7,9 @@ namespace INMOST ...@@ -7,7 +7,9 @@ namespace INMOST
class AdaptiveMesh class AdaptiveMesh
{ {
Mesh * m; Mesh * m;
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
Model * model; Model * model;
#endif
ElementSet root; //< Root set that links all the other sets for coarsements ElementSet root; //< Root set that links all the other sets for coarsements
//TagInteger tag_status; //TagInteger tag_status;
TagInteger set_id; TagInteger set_id;
...@@ -36,7 +38,9 @@ namespace INMOST ...@@ -36,7 +38,9 @@ namespace INMOST
/// Delete all data related to mesh refinement-coarsement. /// Delete all data related to mesh refinement-coarsement.
void ClearData(); void ClearData();
void PrintSet(std::ostream & fout, ElementSet set); void PrintSet(std::ostream & fout, ElementSet set);
#if defined(USE_AUTODIFF) && defined(USE_SOLVER)
void SetModel(Model * mm) {model = mm;} void SetModel(Model * mm) {model = mm;}
#endif
//the work on each cell is supposed to be proportional to the number of cells refined //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 //this number is equal to number of original nodes
void ComputeWeightRefine(TagInteger indicator, TagReal weight); void ComputeWeightRefine(TagInteger indicator, TagReal weight);
......
...@@ -5,8 +5,10 @@ if (USE_MESH) ...@@ -5,8 +5,10 @@ if (USE_MESH)
add_subdirectory(GridGen) add_subdirectory(GridGen)
add_subdirectory(GridTools) add_subdirectory(GridTools)
endif (USE_MESH) endif (USE_MESH)
if (USE_OPTIMIZER) if (USE_OPTIMIZER AND USE_SOLVER)
add_subdirectory(OptimizerSolve) add_subdirectory(OptimizerSolve)
endif ()
if (USE_OPTIMIZER)
add_subdirectory(OptimizerFunction) add_subdirectory(OptimizerFunction)
endif () endif ()
if (USE_SOLVER) if (USE_SOLVER)
......
...@@ -158,7 +158,11 @@ int main(int argc, char *argv[]) ...@@ -158,7 +158,11 @@ int main(int argc, char *argv[])
{ {
//if( *t == m1.CoordsTag() ) continue; //if( *t == m1.CoordsTag() ) continue;
//if( t->GetSize() == ENUMUNDEF ) 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()) ) if( m2.HaveTag(t->GetTagName()) )
{ {
Tag t2 = m2.GetTag(t->GetTagName()); Tag t2 = m2.GetTag(t->GetTagName());
...@@ -227,6 +231,7 @@ int main(int argc, char *argv[]) ...@@ -227,6 +231,7 @@ int main(int argc, char *argv[])
Lvol += vol; Lvol += vol;
} }
} }
#if defined(USE_AUTODIFF)
else if( t->GetDataType() == DATA_VARIABLE ) else if( t->GetDataType() == DATA_VARIABLE )
{ {
Storage::var_array arr1 = c1->VariableArray(*t); Storage::var_array arr1 = c1->VariableArray(*t);
...@@ -257,6 +262,7 @@ int main(int argc, char *argv[]) ...@@ -257,6 +262,7 @@ int main(int argc, char *argv[])
Lvol += vol; Lvol += vol;
} }
} }
#endif
} }
} }
if( diff_size ) std::cout << "Size is different on " << diff_size << " / " << tot_size << " of " << ElementTypeName(etype) << std::endl; 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) ...@@ -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 source = it->RealArray(transfer_node_real_tags[q]);
Storage::real_array target = image->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()); 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]; target[qq] = source[qq];
} }
...@@ -214,7 +214,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier) ...@@ -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 source = it->IntegerArray(transfer_node_integer_tags[q]);
Storage::integer_array target = image->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()); 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]; target[qq] = source[qq];
} }
...@@ -328,7 +328,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier) ...@@ -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 source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = f.first->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()); 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]; target[qq] = source[qq];
} }
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q) 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) ...@@ -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 source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = f.first->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()); 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]; target[qq] = source[qq];
} }
...@@ -433,7 +433,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier) ...@@ -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 source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = facesb.first->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()); 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]; target[qq] = source[qq];
} }
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q) 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) ...@@ -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 source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = facesb.first->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()); 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]; target[qq] = source[qq];
} }
} }
...@@ -490,7 +490,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier) ...@@ -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 source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = facesf.first->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()); 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]; target[qq] = source[qq];
} }
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q) 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) ...@@ -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 source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = facesf.first->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()); 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]; target[qq] = source[qq];
} }
} }
...@@ -825,7 +825,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier) ...@@ -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 source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = f.first->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()); 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]; target[qq] = source[qq];
} }
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q) 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) ...@@ -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 source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = f.first->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()); 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]; target[qq] = source[qq];
} }
} }
...@@ -911,7 +911,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier) ...@@ -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 source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = facesb.first->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()); 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]; target[qq] = source[qq];
} }
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q) 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) ...@@ -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 source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = facesb.first->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()); 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]; target[qq] = source[qq];
} }
} }
...@@ -954,7 +954,7 @@ void Fracture::Open(Tag aperture, bool fill_fracture, double gap_multiplier) ...@@ -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 source = it->RealArray(transfer_face_real_tags[q]);
Storage::real_array target = facesf.first->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()); 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]; target[qq] = source[qq];
} }
for(int q = 0; q < (int)transfer_face_integer_tags.size(); ++q) 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) ...@@ -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 source = it->IntegerArray(transfer_face_integer_tags[q]);
Storage::integer_array target = facesf.first->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()); 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]; target[qq] = source[qq];
} }
} }
......
...@@ -83,6 +83,7 @@ int main(int argc, char ** argv) ...@@ -83,6 +83,7 @@ int main(int argc, char ** argv)
else if( comp < oarr.size() ) std::cout << oarr[comp] << "; "; else if( comp < oarr.size() ) std::cout << oarr[comp] << "; ";
else std::cout << "NAN; "; else std::cout << "NAN; ";
} }
#if defined(USE_AUTODIFF)
else if( otag.GetDataType() == DATA_VARIABLE ) else if( otag.GetDataType() == DATA_VARIABLE )
{ {
Storage::var_array oarr = it->VariableArray(otag); Storage::var_array oarr = it->VariableArray(otag);
...@@ -90,6 +91,7 @@ int main(int argc, char ** argv) ...@@ -90,6 +91,7 @@ int main(int argc, char ** argv)
else if( comp < oarr.size() ) std::cout << get_value(oarr[comp]) << "; "; else if( comp < oarr.size() ) std::cout << get_value(oarr[comp]) << "; ";
else std::cout << "NAN; "; else std::cout << "NAN; ";
} }
#endif
else if( otag.GetDataType() == DATA_INTEGER ) else if( otag.GetDataType() == DATA_INTEGER )
{ {
Storage::integer_array oarr = it->IntegerArray(otag); Storage::integer_array oarr = it->IntegerArray(otag);
......
...@@ -60,8 +60,8 @@ void init2d(double * arr, int N, double mint, double maxt) ...@@ -60,8 +60,8 @@ void init2d(double * arr, int N, double mint, double maxt)
double intrp2d(double * arr, int N, double x, double y) double intrp2d(double * arr, int N, double x, double y)
{ {
int n = ceil(x*(N-1)); int n = static_cast<int>(ceil(x*(N-1)));
int m = ceil(y*(N-1)); int m = static_cast<int>(ceil(y*(N-1)));
if( n == 0 ) n = 1; if( n == 0 ) n = 1;
if( m == 0 ) m = 1; if( m == 0 ) m = 1;
double dh = 1.0/(double)(N-1); double dh = 1.0/(double)(N-1);
...@@ -154,7 +154,7 @@ void SetLayers::DeformLayers(double coef) ...@@ -154,7 +154,7 @@ void SetLayers::DeformLayers(double coef)
c->Centroid(cnt); c->Centroid(cnt);
for(int d = 0; d < 3; ++d) for(int d = 0; d < 3; ++d)
cc[d] = (cnt[d]-cmin[d])/(cmax[d]-cmin[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; layer_tag[*c] = lc.first;
coef_tag[*c] = lc.second; coef_tag[*c] = lc.second;
...@@ -164,7 +164,7 @@ void SetLayers::DeformLayers(double coef) ...@@ -164,7 +164,7 @@ void SetLayers::DeformLayers(double coef)
double c[3] = {0,0,0}; double c[3] = {0,0,0};
for(int d = 0; d < 3; ++d) for(int d = 0; d < 3; ++d)
c[d] = (n->Coords()[d]-cmin[d])/(cmax[d]-cmin[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; if( lc.first == -1 ) std::cout << "layer not found for " << c[0] << "," << c[1] << "," << c[2] << " node " << n->LocalID() << std::endl;
double h = 0; double h = 0;
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
// //
#include "dynamic_r2.h" #include "dynamic_r2.h"
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
DynamicR2::DynamicR2() : distribution(-0.04, 0.04) { DynamicR2::DynamicR2() : distribution(-0.04, 0.04) {
unsigned int seed = static_cast<unsigned int>(time(NULL)); unsigned int seed = static_cast<unsigned int>(time(NULL));
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#include "static_sin.h"