Commit 4792fc70 authored by Kirill Terekhov's avatar Kirill Terekhov

Fixes

Fixes for gcc and intel compilers.
gcc-4.1 clean with -Wall -Wextra
intel 11.1 clean with -Wcheck -w1
msvc2010 gives one unrelated warning
parent b73dc746
......@@ -43,6 +43,9 @@ set(HEADER inmost.h
add_library(inmost STATIC ${SOURCE} ${HEADER})
option(USE_MPI "Compile with MPI support" ON)
option(USE_MPI_P2P "Use MPI point to point functionality, may be faster with hardware support" ON)
option(USE_MPI_FILE "Use MPI extension to work with files, may save a lot of memory" ON)
option(USE_MPI2 "Use MPI-2 extensions, useful if your MPI library produces warnings to use new functions" ON)
option(USE_OMP "Compile with OpenMP support (experimental)" OFF)
option(USE_MESH "Compile mesh capabilities" ON)
......@@ -77,13 +80,11 @@ endif()
if(USE_MPI)
find_package(MPI)
if(NOT MPI_FOUND)
option(USE_MPI "Use Message Passing Interface" OFF)
option(USE_MPI2 "Use MPI-2 functions" OFF)
set(USE_MPI OFF)
message("MPI NOT FOUND")
else()
include_directories(${MPI_INCLUDE_PATH})
option(USE_MPI "Use Message Passing Interface" ON)
option(USE_MPI2 "Use MPI-2 functions" ON)
set(USE_MPI ON)
set_target_properties(inmost PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
message("MPI FOUND")
endif()
......@@ -95,18 +96,18 @@ if(USE_OMP)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
else()
option(USE_OMP "Compile with OpenMP support (experimental)" OFF)
set(USE_OMP OFF)
endif()
endif()
if(USE_PARTITIONER_PARMETIS)
find_package(ParMETIS)
if(NOT PARMETIS_FOUND)
option(USE_PARTITIONER_PARMETIS "Use ParMetis partitioner" OFF)
set(USE_PARTITIONER_PARMETIS OFF)
message("PARMETIS NOT FOUND")
else()
include_directories(${PARMETIS_INCLUDE_DIR})
option(USE_PARTITIONER_PARMETIS "Use ParMetis partitioner" ON)
set(USE_PARTITIONER_PARMETIS ON)
message("PARMETIS FOUND")
endif()
endif()
......@@ -115,11 +116,11 @@ endif()
if(USE_PARTITIONER_ZOLTAN)
find_package(ZOLTAN)
if(NOT ZOLTAN_FOUND)
option(USE_PARTITIONER_ZOLTAN "Use Zoltan partitioner" OFF)
set(USE_PARTITIONER_ZOLTAN OFF)
message("ZOLTAN NOT FOUND")
else()
include_directories(${ZOLTAN_INCLUDE_DIRS})
option(USE_PARTITIONER_ZOLTAN "Use Zoltan partitioner" ON)
set(USE_PARTITIONER_ZOLTAN ON)
message("ZOLTAN FOUND")
endif()
endif()
......@@ -127,11 +128,11 @@ endif()
if(USE_SOLVER_PETSC)
find_package(PETSc)
if(NOT PETSC_FOUND)
option(USE_SOLVER_PETSC "Use PETSc solver" OFF)
set(USE_SOLVER_PETSC OFF)
message("PETSC NOT FOUND")
else()
include_directories(${PETSC_INCLUDES})
option(USE_SOLVER_PETSC "Use PETSc solver" ON)
set(USE_SOLVER_PETSC ON)
message("PETSC FOUND")
add_definitions(${PETSC_DEFINITIONS})
#message(${PETSC_LIBRARIES})
......@@ -142,16 +143,16 @@ endif()
if(USE_AUTODIFF_OPENCL)
find_package(OpenCL)
if(OPENCL_FOUND)
option(USE_AUTODIFF_OPENCL "Use OpenCL for automatic differentiation" ON)
set(USE_AUTODIFF_OPENCL ON)
include_directories(${OPENCL_INCLUDE_DIRS})
else()
option(USE_AUTODIFF_OPENCL "Use OpenCL for automatic differentiation" OFF)
set(USE_AUTODIFF_OPENCL OFF)
message("OpenCL not found")
endif()
endif()
if(USE_AUTODIFF_ASMJIT)
Set(ASMJIT_STATIC TRUE)
set(ASMJIT_STATIC TRUE)
include("AsmJit/CMakeLists.txt")
include_directories("${ASMJIT_INC_DIR}/asmjit")
target_link_libraries(inmost asmjit)
......
......@@ -76,15 +76,10 @@ mesh + !partitioner + !domain + solvers + +/-nonlinear solvers + autodiff + !sys
23) ,
24)
25) ,
30) - sort ReorderApply , chunk_array
ReorderApply radix-?
32) , , Cell, Face, Edge Node
35) Bridge*
37) container.hpp,
38) GatherBoundaryFaces/GatherInteriorFaces
39) CastRay ,
......@@ -94,7 +89,6 @@ mesh + !partitioner + !domain + solvers + +/-nonlinear solvers + autodiff + !sys
45) ?
. ( )
47) , , ?
49) -
......@@ -104,14 +98,15 @@ mesh + !partitioner + !domain + solvers + +/-nonlinear solvers + autodiff + !sys
52) , radix big-endian
53) SortByGlobalID, globalid
54) ( unit tests)
55) mpi_send/mpi_recv -
7.MSPP: : , ,
7.MSPP: () : , ,
8.MSPP:
9.MSPP: visual studio
9.MSPP: () visual studio
10.MSPP: ( )
11.
11. ()
12. (, )
12. MSPP: Mesh
12. () MSPP: Mesh
13. MSPP: Redistribute!!! ExchangeGhost
13. INMOST / MMTK = Mathematical Modelling ToolKit / NSTK
......
......@@ -218,10 +218,10 @@ namespace INMOST
switch (var.op)
{
case AD_COND_TYPE:
lval = (e->GetElementType() & reinterpret_cast<ElementType>(var.left))? 1.0 : -1.0;
lval = (e->GetElementType() & (*(ElementType*)&var.left))? 1.0 : -1.0;
return lval;
case AD_COND_MARK:
lval = e->GetMarker(reinterpret_cast<MarkerType>(var.left))? 1.0 : -1.0;
lval = e->GetMarker(*(MarkerType *)&var.left)? 1.0 : -1.0;
return lval;
case AD_COND:
lval = Evaluate(*var.left, e, user_data);
......@@ -329,7 +329,7 @@ namespace INMOST
{
stencil_pairs get_st;
reinterpret_cast<stencil_callback>(st.link)(e, get_st, user_data);
for (INMOST_DATA_ENUM_TYPE k = 0; k < get_st.size(); ++k) if( get_st[k].first != NULL )
for (INMOST_DATA_ENUM_TYPE k = 0; k < get_st.size(); ++k) if( get_st[k].first != InvalidHandle() )
{
lval = DerivativePrecompute(*var.left, Storage(m,get_st[k].first), values, user_data);
ret += lval * get_st[k].second;
......@@ -454,7 +454,7 @@ namespace INMOST
{
stencil_pairs get_st;
reinterpret_cast<stencil_callback>(st.link)(e, get_st, user_data);
for (INMOST_DATA_ENUM_TYPE k = static_cast<INMOST_DATA_ENUM_TYPE>(get_st.size()); k > 0; --k) if( get_st[k-1].first != NULL )
for (INMOST_DATA_ENUM_TYPE k = static_cast<INMOST_DATA_ENUM_TYPE>(get_st.size()); k > 0; --k) if( get_st[k-1].first != InvalidHandle() )
DerivativeFill(*var.left, Storage(m,get_st[k - 1].first), entries, values, var.coef * get_st[k - 1].second*multval, user_data);
}
return;
......@@ -477,8 +477,8 @@ namespace INMOST
assert(var.op != AD_NONE);
switch (var.op)
{
case AD_COND_MARK: return e->GetMarker(reinterpret_cast<MarkerType>(var.left)) ? 1.0 : -1.0;
case AD_COND_TYPE: return (e->GetElementType() & reinterpret_cast<ElementType>(var.left)) ? 1.0 : -1.0;
case AD_COND_MARK: return e->GetMarker(*(MarkerType *)&var.left) ? 1.0 : -1.0;
case AD_COND_TYPE: return (e->GetElementType() & (*(ElementType *)&var.left)) ? 1.0 : -1.0;
case AD_COND: return Evaluate(*(Evaluate(*var.left, e, user_data) > 0.0 ? var.right->left : var.right->right), e, user_data)*var.coef;
case AD_PLUS: return (Evaluate(*var.left, e, user_data) + Evaluate(*var.right, e, user_data))*var.coef;
case AD_MINUS: return (Evaluate(*var.left, e, user_data) - Evaluate(*var.right, e, user_data))*var.coef;
......@@ -515,7 +515,7 @@ namespace INMOST
{
stencil_pairs get_st;
reinterpret_cast<stencil_callback>(st.link)(e, get_st, user_data);
for (INMOST_DATA_ENUM_TYPE k = 0; k < get_st.size(); ++k) if ( get_st[k].first != NULL )
for (INMOST_DATA_ENUM_TYPE k = 0; k < get_st.size(); ++k) if ( get_st[k].first != InvalidHandle() )
ret += var.coef * Evaluate(*var.left, Storage(m,get_st[k].first), user_data) * get_st[k].second;
}
return ret;
......
......@@ -119,21 +119,21 @@ namespace INMOST
MarkerType hm = m->HideMarker();
if( Element::GetGeometricDimension(m->GetGeometricType(GetHandle())) == 2 ) // This cell is 2d face
{
integer i = -1, k = -1, k1 = -1, k2;
enumerator i = ENUMUNDEF, k = ENUMUNDEF, k1 = ENUMUNDEF, k2;
adj_type const & lc = m->LowConn(GetHandle());
aret.reserve(lc.size());
i = m->getNext(lc.data(),static_cast<integer>(lc.size()),i,hm);
i = m->getNext(lc.data(),static_cast<enumerator>(lc.size()),i,hm);
HandleType q = lc[i]; //edge 0
adj_type const & qlc = m->LowConn(q);
k = m->getNext(qlc.data(),static_cast<integer>(qlc.size()),k,hm);
k = m->getNext(qlc.data(),static_cast<enumerator>(qlc.size()),k,hm);
aret.push_back(qlc[k]); //node 0
k = m->getNext(qlc.data(),static_cast<integer>(qlc.size()),k,hm);
k = m->getNext(qlc.data(),static_cast<enumerator>(qlc.size()),k,hm);
aret.push_back(qlc[k]); //node 1
i = m->getNext(lc.data(),static_cast<integer>(lc.size()),i,hm);
i = m->getNext(lc.data(),static_cast<enumerator>(lc.size()),i,hm);
HandleType r = lc[i]; //edge 1
adj_type const & rlc = m->LowConn(r);
k1 = m->getNext(rlc.data(),static_cast<integer>(rlc.size()),k1,hm);
k2 = m->getNext(rlc.data(),static_cast<integer>(rlc.size()),k1,hm);
k1 = m->getNext(rlc.data(),static_cast<enumerator>(rlc.size()),k1,hm);
k2 = m->getNext(rlc.data(),static_cast<enumerator>(rlc.size()),k1,hm);
if( aret.data()[0] == rlc[k1] || aret.data()[0] == rlc[k2] )
{
HandleType temp = aret.data()[0];
......@@ -144,9 +144,9 @@ namespace INMOST
while(it < iend) if( !m->GetMarker(lc[it],hm) ) //loop over edges
{
adj_type const & ilc = m->LowConn(lc[it]);
k1 = -1;
k1 = m->getNext(ilc.data(),static_cast<integer>(ilc.size()),k1,hm);
k2 = m->getNext(ilc.data(),static_cast<integer>(ilc.size()),k1,hm);
k1 = ENUMUNDEF;
k1 = m->getNext(ilc.data(),static_cast<enumerator>(ilc.size()),k1,hm);
k2 = m->getNext(ilc.data(),static_cast<enumerator>(ilc.size()),k1,hm);
if( aret.atback() == ilc[k1] )
aret.push_back(ilc[k2]);
else
......@@ -242,24 +242,24 @@ namespace INMOST
MarkerType hm = GetMeshLink()->HideMarker();
if( Element::GetGeometricDimension(m->GetGeometricType(GetHandle())) == 2 ) // This cell is 2d face
{
integer i = -1, k = -1, k1 = -1, k2;
enumerator i = ENUMUNDEF, k = ENUMUNDEF, k1 = ENUMUNDEF, k2;
HandleType last, first;
adj_type const & lc = m->LowConn(GetHandle());
aret.reserve(lc.size());
i = m->getNext(lc.data(),static_cast<integer>(lc.size()),i,hm);
i = m->getNext(lc.data(),static_cast<enumerator>(lc.size()),i,hm);
HandleType q = lc[i]; //edge 0
adj_type const & qlc = m->LowConn(q);
k = m->getNext(qlc.data(),static_cast<integer>(qlc.size()),k,hm);
k = m->getNext(qlc.data(),static_cast<enumerator>(qlc.size()),k,hm);
if( invert ^ m->GetMarker(qlc[k],mask) ) aret.push_back(qlc[k]); //node 0
first = qlc[k];
k = m->getNext(qlc.data(),static_cast<integer>(qlc.size()),k,hm);
k = m->getNext(qlc.data(),static_cast<enumerator>(qlc.size()),k,hm);
if( invert ^ m->GetMarker(qlc[k],mask) ) aret.push_back(qlc[k]); //node 1
last = qlc[k];
i = m->getNext(lc.data(),static_cast<integer>(lc.size()),i,hm);
i = m->getNext(lc.data(),static_cast<enumerator>(lc.size()),i,hm);
HandleType r = lc[i]; //edge 1
adj_type const & rlc = m->LowConn(r);
k1 = m->getNext(rlc.data(),static_cast<integer>(rlc.size()),k1,hm);
k2 = m->getNext(rlc.data(),static_cast<integer>(rlc.size()),k1,hm);
k1 = m->getNext(rlc.data(),static_cast<enumerator>(rlc.size()),k1,hm);
k2 = m->getNext(rlc.data(),static_cast<enumerator>(rlc.size()),k1,hm);
if( first == rlc[k1] || first == rlc[k2] )
{
last = first;
......@@ -274,9 +274,9 @@ namespace INMOST
while(it != iend) if( !m->GetMarker(lc[it],hm) ) //loop over edges
{
adj_type const & ilc = m->LowConn(lc[it]);
k1 = -1;
k1 = m->getNext(ilc.data(),static_cast<integer>(ilc.size()),k1,hm);
k2 = m->getNext(ilc.data(),static_cast<integer>(ilc.size()),k1,hm);
k1 = ENUMUNDEF;
k1 = m->getNext(ilc.data(),static_cast<enumerator>(ilc.size()),k1,hm);
k2 = m->getNext(ilc.data(),static_cast<enumerator>(ilc.size()),k1,hm);
if( last == ilc[k1] )
last = ilc[k2];
else last = ilc[k1];
......
......@@ -258,4 +258,4 @@ namespace INMOST
else std::sort(h,h+n);
}
}
#endif
\ No newline at end of file
#endif
#pragma once
#ifndef _CONTAINER_HPP
#define _CONTAINER_HPP
......@@ -665,7 +665,7 @@ namespace INMOST
}
void push_back(const element & e)
{
assert( !fixed && "array size is fixed");
assert( !fixed ); // array size is fixed
#if !defined(USE_OPTIMIZED_ARRAY_ALLOCATION)
//unoptimized variant
if( (*m_size)+1 > array<element>::growth_formula(*m_size) )
......@@ -684,7 +684,7 @@ namespace INMOST
}
void pop_back()
{
assert( !fixed && "array size is fixed");
assert( !fixed ); // array size is fixed
assert((*m_arr) != NULL);
(*m_arr)[(*m_size)--].~element();
if( (*m_size) > 0 )
......@@ -734,7 +734,7 @@ namespace INMOST
__INLINE bool empty() const { if( *m_size ) return false; return true; }
void resize(size_type n, element c = element() )
{
assert( !fixed && "array size is fixed");
assert( !fixed ); // array size is fixed
size_type oldsize = *m_size;
*m_size = n;
for(size_type i = *m_size; i < oldsize; i++) (*m_arr)[i].~element(); //delete elements, located over the size
......@@ -754,7 +754,7 @@ namespace INMOST
__INLINE size_type size() const {return *m_size;}
void clear()
{
assert( !fixed && "array size is fixed");
assert( !fixed ); // array size is fixed
for(size_type i = 0; i < *m_size; i++) (*m_arr)[i].~element();
*m_size = 0;
if( *m_arr ) free(*m_arr);
......@@ -779,7 +779,7 @@ namespace INMOST
__INLINE const_reverse_iterator rend() const { return const_reverse_iterator(*m_arr-1); }
iterator erase(iterator pos)
{
assert( !fixed && "array size is fixed");
assert( !fixed ); // array size is fixed
ptrdiff_t d = pos-begin();
ptrdiff_t s = iterator(*m_arr+(*m_size)-1)-pos;
(*pos).~element();
......@@ -806,7 +806,7 @@ namespace INMOST
}
iterator erase(iterator b, iterator e)
{
assert( !fixed && "array size is fixed");
assert( !fixed ); // array size is fixed
ptrdiff_t d = b-begin();
ptrdiff_t s = end()-e;
ptrdiff_t n = e-b;
......@@ -829,7 +829,7 @@ namespace INMOST
}
iterator insert(iterator pos, const element & x)
{
assert( !fixed && "array size is fixed");
assert( !fixed ); // array size is fixed
if( static_cast<void *>(pos) == NULL )
{
assert((*m_arr) == NULL);
......@@ -859,7 +859,7 @@ namespace INMOST
}
void insert(iterator pos, size_type n, const element & x)
{
assert( !fixed && "array size is fixed");
assert( !fixed ); // array size is fixed
if( n > 0 )
{
if( static_cast<void *>(pos) == NULL)
......@@ -883,7 +883,7 @@ namespace INMOST
template <class InputIterator>
void insert(iterator pos, InputIterator first, InputIterator last)
{
assert( !fixed && "array size is fixed");
assert( !fixed ); // array size is fixed
ptrdiff_t n = static_cast<ptrdiff_t>(std::distance(first,last));
if( n > 0 )
{
......@@ -926,7 +926,7 @@ namespace INMOST
for(iterator it = m_first; it != m_last; it++) (*it).~element();
if( n-q != 0 )
{
assert( !fixed && "array size is fixed");
assert( !fixed ); // array size is fixed
size_type gf = array<element>::growth_formula((*m_size)+static_cast<size_type>(n-q));
if( gf != array<element>::growth_formula(*m_size) )
*m_arr = static_cast<element *>(realloc(*m_arr,sizeof(element)*gf));
......
This diff is collapsed.
......@@ -5,12 +5,10 @@ namespace INMOST
template<typename StorageType>
void ElementArray<StorageType>::Unite(const HandleType * h, INMOST_DATA_ENUM_TYPE num)
{
assert(GetMeshLink() == other.GetMeshLink());
if( empty() ) container.insert(container.end(),h,h+num);
else
{
Mesh * m = GetMeshLink();
size_type s = size();
MarkerType mrk = m->CreateMarker();
SetMarker(mrk);
for(INMOST_DATA_ENUM_TYPE it = 0; it < num; it++)
......@@ -27,7 +25,6 @@ namespace INMOST
template<typename StorageType>
void ElementArray<StorageType>::Subtract(const HandleType * h, INMOST_DATA_ENUM_TYPE num)
{
assert(GetMeshLink() == other.GetMeshLink());
if( !empty() )
{
Mesh * mesh = GetMeshLink();
......@@ -96,4 +93,4 @@ namespace INMOST
template class ElementArray<Cell>;
template class ElementArray<Storage>;
}
#endif
\ No newline at end of file
#endif
......@@ -19,9 +19,9 @@ namespace INMOST
adj_type const & lc = m->LowConn(GetHandle());
if( !lc.empty() )
{
integer i = -1;
enumerator i = ENUMUNDEF;
MarkerType hm = m->HideMarker();
i = m->getNext(lc.data(),static_cast<integer>(lc.size()),i,hm);
i = m->getNext(lc.data(),static_cast<enumerator>(lc.size()),i,hm);
if( i != lc.size() ) return Node(m,lc[i]);
}
return Node(m,InvalidHandle());
......@@ -43,10 +43,10 @@ namespace INMOST
adj_type const & lc = m->LowConn(GetHandle());
if( !lc.empty() )
{
integer i = -1;
enumerator i = ENUMUNDEF;
MarkerType hm = m->HideMarker();
i = m->getNext(lc.data(),static_cast<integer>(lc.size()),i,hm);
i = m->getNext(lc.data(),static_cast<integer>(lc.size()),i,hm);
i = m->getNext(lc.data(),static_cast<enumerator>(lc.size()),i,hm);
i = m->getNext(lc.data(),static_cast<enumerator>(lc.size()),i,hm);
if( i != lc.size() ) return Node(m,lc[i]);
}
return Node(m,InvalidHandle());
......
......@@ -76,6 +76,7 @@ namespace INMOST
void ElementSet::AddChild(const ElementSet & child) const
{
assert(GetElementType() == ESET);
assert(child->GetElementType() == ESET);
Mesh * m = GetMeshLink();
Element::adj_type & parent_hc = m->HighConn(GetHandle());
assert(isValid());
......@@ -93,6 +94,7 @@ namespace INMOST
void ElementSet::AddSibling(const ElementSet & sibling) const
{
assert(GetElementType() == ESET);
assert(sibling->GetElementType() == ESET);
Mesh * m = GetMeshLink();
//perform checks
Element::adj_type & current_hc = m->HighConn(GetHandle());
......@@ -279,13 +281,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
else
{
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & etype) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & etype) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
return ret;
......@@ -301,13 +303,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & etype) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
++ret;
}
else
{
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & etype) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & etype) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
++ret;
}
return ret;
......@@ -345,13 +347,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & NODE) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & NODE) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
else
{
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & NODE) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & NODE) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
return ret;
......@@ -389,13 +391,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & EDGE) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & EDGE) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
else
{
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & EDGE) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & EDGE) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
return ret;
......@@ -433,13 +435,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & FACE) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & FACE) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
else
{
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & FACE) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & FACE) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
return ret;
......@@ -477,13 +479,13 @@ namespace INMOST
{
MarkerType hm = m->HideMarker();
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & CELL) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & CELL) && !m->GetMarker(lc[it],hm) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
else
{
for(Element::adj_type::size_type it = 0; it < lc.size(); ++it)
if( (GetHandleElementType(lc[it]) & CELL) && (invert ^ m->GetMarker(lc[it],invert)) )//check for type filters invalid handles
if( (GetHandleElementType(lc[it]) & CELL) && (invert ^ m->GetMarker(lc[it],select)) )//check for type filters invalid handles
ret.push_back(lc[it]);
}
return ret;
......@@ -913,7 +915,7 @@ namespace INMOST
}
}
Element::adj_type & other_lc = m->LowConn(other->GetHandle());
for(const HandleType * h = lc.data(); h != lc.data() + lc.size(); ++h)
for(const HandleType * h = other_lc.data(); h != other_lc.data() + other_lc.size(); ++h)
{
if( *h != InvalidHandle() && !m->GetMarker(*h,mrk) )
{
......@@ -1498,7 +1500,7 @@ namespace INMOST
{
assert(GetElementType() == ESET);
Element::adj_type & lc = GetMeshLink()->LowConn(GetHandle());
return ++iterator(GetMeshLink(),&lc,-1);
return ++iterator(GetMeshLink(),&lc,static_cast<Element::adj_type::size_type>(-1));
}
ElementSet::iterator ElementSet::End() const
......@@ -1560,11 +1562,11 @@ namespace INMOST
if( BulkDF(m->SetComparatorTag()) == UNSORTED_COMPARATOR ) //just compact the set
{
// This should be O(m) where m is the number of deleted items
Element::adj_type::size_type cend = lc.size()-1;
while( cend >= 0 && cend < lc.size() && lc[cend] == InvalidHandle() ) --cend; //find first good handle
while( cend >= 0 && cend < lc.size() && hc.size() > high_conn_reserved )
integer cend = static_cast<integer>(lc.size()-1);
while( cend >= 0 && lc[cend] == InvalidHandle() ) --cend; //find first good handle
while( cend >= 0 && hc.size() > high_conn_reserved )
{
if( hc.back() >= cend )
if( static_cast<integer>(hc.back()) >= cend )
hc.pop_back();
else if( lc[cend] != InvalidHandle() )
{
......@@ -1573,7 +1575,7 @@ namespace INMOST
}
else cend--;
}
while( cend >= 0 && cend < lc.size() && lc[cend] == InvalidHandle() ) --cend; //skip bad handles
while( cend >= 0 && lc[cend] == InvalidHandle() ) --cend; //skip bad handles
lc.resize(cend);
hc.resize(high_conn_reserved);
}
......
......@@ -9,6 +9,7 @@
#include <iostream>
#include <sstream>
#include <algorithm>
#include <stdarg.h>
#include "my_glut.h"
......@@ -389,7 +390,7 @@ class kdtree
}
}
}
kdtree() : set(NULL), size(0), children(NULL), marked(0) {}
kdtree() : marked(0), set(NULL), size(0), children(NULL) {}
inline int plane_bbox(double p[3], double n[3])
{
Storage::real pv[3], nv[3];
......@@ -504,7 +505,7 @@ class kdtree
}
void clear_children() { if( children ) {children[0].clear_children(); children[1].clear_children(); free(children);}}
public:
kdtree(Mesh * m) : m(m),children(NULL), marked(0)
kdtree(Mesh * m) : marked(0),m(m),children(NULL)
{
double tt;
size = m->NumberOfEdges();
......@@ -526,21 +527,21 @@ public:
fflush(stdout);
}
}
printf("Done. Time %g\n",Timer()-tt);
printf("Done. Time %lg\n",Timer()-tt);
int done = 0, total = size;
printf("Building KD-tree.\n");
tt = Timer();
struct entry * temp = new entry[size];
kdtree_build(0,done,total,temp);
delete [] temp;
printf("Done. Time %g\n",Timer()-tt);
printf("Done. Time %lg\n",Timer()-tt);
for(int k = 0; k < 3; k++)
{
bbox[0+2*k] = std::min(children[0].bbox[0+2*k],children[1].bbox[0+2*k]);
bbox[1+2*k] = std::max(children[0].bbox[1+2*k],children[1].bbox[1+2*k]);
}
}
kdtree(Mesh * m, HandleType * eset, INMOST_DATA_ENUM_TYPE size) : m(m),children(NULL), marked(0), size(size)
kdtree(Mesh * m, HandleType * eset, INMOST_DATA_ENUM_TYPE size) : marked(0), m(m),size(size),children(NULL)
{
double tt;
assert(size > 1);
......@@ -561,14 +562,14 @@ public:
fflush(stdout);
}
}
printf("Done. Time %g\n",Timer()-tt);
printf("Done. Time %lg\n",Timer()-tt);
int done = 0, total = size;
printf("Building KD-tree.\n");
tt = Timer();
struct entry * temp = new entry[size];
kdtree_build(0,done,total,temp);
delete [] temp;
printf("Done. Time %g\n",Timer()-tt);
printf("Done. Time %lg\n",Timer()-tt);
for(int k = 0; k < 3; k++)
{
bbox[0+2*k] = std::min(children[0].bbox[0+2*k],children[1].bbox[0+2*k]);
......@@ -766,7 +767,7 @@ public:
//printf("%s:%d this should not happen!\n",__FILE__,__LINE__);
}
if( nfulledges == edges.size() )
if( nfulledges == static_cast<int>(edges.size()) )
{
full_face = faces[q];
break;
......@@ -826,7 +827,7 @@ public:
break;
}
}
if( !hit ) printf("%s:%d cannot find end for edge! total edges %d current loop size %d\n",
if( !hit ) printf("%s:%d cannot find end for edge! total edges %d current loop size %ld\n",
__FILE__,__LINE__,ntotedges,loopcoords.size());
}
Storage::real_array cl = cells[k]->RealArray(clips);
......@@ -1171,7 +1172,6 @@ class kdtree_picker
face2gl & f = in[set[0].index];
double * tri[3], btri[3][3], dot[3], prod[3][3], norm[3], d, proj[3];
tri[0] = f.get_center();
Storage::real maxdist = 0;
for(INMOST_DATA_ENUM_TYPE i = 0; i < f.size(); i++)
{
INMOST_DATA_ENUM_TYPE j = (i+1)%f.size();
......@@ -1444,6 +1444,8 @@ void myclick(int b, int s, int nmx, int nmy) // Mouse
void keyboard(unsigned char key, int x, int y)
{
(void) x;
(void) y;
if( key == 27 )
{
if( oclipper ) delete oclipper;
......@@ -1591,6 +1593,8 @@ void keyboard(unsigned char key, int x, int y)
void keyboard2(unsigned char key, int x, int y)
{
(void) x;
(void) y;
if( key == '=' || key == '+' || key == '_' || key == '-' || key == 'w' || key == 's' || key == 'a' || key == 'd' || key == 'r' || key == 'p' || key == 'z')
{