Commit 682f9db1 by Kirill Terekhov

New version

parent da034104
.svn
tests/solver_test001/matrices
solver_mtiluc2.cpp
solver_mtiluc2.hpp
solver_mtilu2.hpp
Tests/solver_test001/matrices
SyncToy*
cmake_minimum_required (VERSION 2.6)
project (INMOST)
set(SOURCE solver.cpp
solver_ani.cpp
solver_petsc.cpp
partitioner.cpp
algorithm.cpp
geometry.cpp
iterator.cpp
storage.cpp
eset.cpp
mesh_file.cpp
timer.cpp
face.cpp
edge.cpp
mesh.cpp
node.cpp
cell.cpp
tag.cpp
element.cpp
mesh_parallel.cpp
modify.cpp
earray.cpp
comparator.cpp
autodiff.cpp
solver_ddpqiluc2.cpp)
set(HEADER inmost.h
inmost_options_cmake.h
inmost_common.h
inmost_mesh.h
inmost_solver.h
inmost_partitioner.h
inmost_autodiff.h
container.hpp
io.hpp
solver_ilu2.hpp
solver_ddpqiluc2.hpp
solver_bcgsl.hpp
solver_prototypes.hpp)
add_subdirectory(Source)
add_definitions(${SOLVER_DEFINITIONS})
include_directories("Source/Headers")
set(INMOST_MAJOR_VERSION 0)
set(INMOST_MINOR_VERSION 1)
set(INMOST_PATCH_VERSION 0)
set(INMOST_VERSION "${INMOST_MAJOR_VERSION}.${INMOST_MINOR_VERSION}.${INMOST_PATCH_VERSION}")
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/solver_mtiluc2.hpp" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/solver_mtiluc2.cpp" )
add_definitions(-DHAVE_SOLVER_MPTILUC2)
set(HAVE_SOLVER_MPTILUC2 TRUE)
list(APPEND HEADER solver_mtiluc2.hpp)
list(APPEND SOURCE solver_mtiluc2.cpp)
else()
set(HAVE_SOLVER_MPTILUC2 FALSE)
endif()
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/solver_mtilu2.hpp" )
add_definitions(-DHAVE_SOLVER_MPTILU2)
set(HAVE_SOLVER_MPTILU2 TRUE)
list(APPEND SOURCE solver_mtilu2.hpp)
else()
set(HAVE_SOLVER_MPTILU2 FALSE)
endif()
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/solver_fcbiilu2.h" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/solver_fcbiilu2.cpp" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/fcbiilu2.cpp" )
add_definitions(-DHAVE_SOLVER_FCBIILU2)
set(HAVE_SOLVER_FCBIILU2 TRUE)
list(APPEND HEADER solver_fcbiilu2.h)
list(APPEND SOURCE solver_fcbiilu2.cpp fcbiilu2.cpp)
else()
set(HAVE_SOLVER_FCBIILU2 FALSE)
endif()
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/solver_k3biilu2.h" AND EXISTS
"${CMAKE_CURRENT_SOURCE_DIR}/solver_k3biilu2.cpp" AND EXISTS
"${CMAKE_CURRENT_SOURCE_DIR}/k3d.h" AND EXISTS
"${CMAKE_CURRENT_SOURCE_DIR}/k3d.cpp" )
add_definitions(-DHAVE_SOLVER_K3BIILU2)
set(HAVE_SOLVER_K3BIILU2 TRUE)
list(APPEND HEADER solver_k3biilu2.h k3d.h)
list(APPEND SOURCE solver_k3biilu2.cpp k3d.cpp)
else()
set(HAVE_SOLVER_K3BIILU2 FALSE)
endif()
add_library(inmost STATIC ${SOURCE} ${HEADER})
......@@ -93,9 +23,9 @@ option(USE_MESH "Compile mesh capabilities" ON)
option(USE_SOLVER "Compile solver capabilities" ON)
option(USE_PARTITIONER "Compile partitioner capabilities" ON)
option(USE_AUTODIFF "Compile automatic differentiation capabilities" ON)
option(USE_NONLINEAR "Compile nonlinear solver capabilities" ON)
option(TEST_FORTRAN_ANI3D "Test for fortran availibility to compile ANI3D lib" OFF)
option(COMPILE_EXAMPLES "Compile examples" OFF)
#option(COMPILE_PROJECTS "Compile projects" OFF)
option(COMPILE_TESTS "Compile some tests" OFF)
option(USE_PARTITIONER_PARMETIS "Use ParMetis partitioner" OFF)
......@@ -145,8 +75,10 @@ if(USE_OMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
message("OpenMP FOUND")
else()
set(USE_OMP OFF)
message("OpenMP NOT FOUND")
endif()
endif()
......@@ -285,52 +217,65 @@ if(MSVC)
endif()
endif()
configure_file("inmost_options_cmake.h" "${PROJECT_BINARY_DIR}/inmost_options.h")
configure_file("Source/Headers/inmost_options_cmake.h" "${PROJECT_BINARY_DIR}/inmost_options.h")
include_directories("${PROJECT_BINARY_DIR}")
target_include_directories(inmost PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
target_include_directories(inmost PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>)
target_include_directories(inmost PUBLIC $<INSTALL_INTERFACE:include>)
if(COMPILE_EXAMPLES)
add_subdirectory(examples)
add_subdirectory(Examples)
endif(COMPILE_EXAMPLES)
#if(COMPILE_PROJECTS)
#add_subdirectory(projects)
#endif(COMPILE_PROJECTS)
if(COMPILE_TESTS)
enable_testing()
include(CTest)
add_subdirectory(tests)
add_subdirectory(Tests)
endif(COMPILE_TESTS)
set(INMOST_INSTALL_HEADERS inmost.h
inmost_options_cmake.h
inmost_common.h
inmost_mesh.h
inmost_solver.h
inmost_partitioner.h
inmost_autodiff.h
container.hpp)
set(INMOST_INSTALL_HEADERS Source/Headers/inmost.h
Source/Headers/inmost_autodiff.h
Source/Headers/inmost_common.h
Source/Headers/inmost_data.h
Source/Headers/inmost_expression.h
Source/Headers/inmost_mesh.h
Source/Headers/inmost_nonlinear.h
Source/Headers/inmost_partitioner.h
Source/Headers/inmost_solver.h
Source/Headers/inmost_sparse.h
Source/Headers/inmost_variable.h
Source/Headers/container.hpp)
include(CPack)
export(TARGETS inmost FILE inmost-targets.cmake)
export(PACKAGE inmost)
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/Source/Headers" "${PROJECT_BINARY_DIR}")
configure_file(inmost-config.cmake.in "${PROJECT_BINARY_DIR}/inmost-config.cmake" @ONLY)
set(CONF_INCLUDE_DIRS "\${inmost_DIR}/include")
configure_file(inmost-config.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/inmost-config.cmake" @ONLY)
configure_file(inmost-config-version.cmake.in "${PROJECT_BINARY_DIR}/inmost-config-version.cmake" @ONLY)
set_property(TARGET inmost PROPERTY PUBLIC_HEADER
"${PROJECT_BINARY_DIR}/inmost_options.h"
"${PROJECT_SOURCE_DIR}/inmost.h"
"${PROJECT_SOURCE_DIR}/inmost_common.h"
"${PROJECT_SOURCE_DIR}/inmost_mesh.h"
"${PROJECT_SOURCE_DIR}/inmost_solver.h"
"${PROJECT_SOURCE_DIR}/inmost_partitioner.h"
"${PROJECT_SOURCE_DIR}/inmost_autodiff.h"
"${PROJECT_SOURCE_DIR}/container.hpp")
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_autodiff.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_common.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_data.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_expression.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_mesh.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_nonlinear.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_partitioner.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_solver.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_sparse.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_variable.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/container.hpp")
install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/inmost-config.cmake"
......
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
##
## # The following are required to submit to the CDash dashboard:
## ENABLE_TESTING()
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "INMOST")
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=INMOST")
set(CTEST_DROP_SITE_CDASH TRUE)
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
##
## # The following are required to submit to the CDash dashboard:
## ENABLE_TESTING()
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "inmost")
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "localhost")
set(CTEST_DROP_LOCATION "/cdash/submit.php?project=inmost")
set(CTEST_DROP_SITE_CDASH TRUE)
......@@ -85,3 +85,31 @@ INMOST::shell<*>{
)
)
}
;------------------------------------------------------------------------------
; INMOST::array
;------------------------------------------------------------------------------
INMOST::array<*>{
preview (
#(
"[",
$e.m_size,
"](",
#array(
expr: ($e.m_arr)[$i],
size: $e.m_size
),
")"
)
)
children (
#(
#([size] : $e.m_size),
#array(
expr: ($e.m_arr)[$i],
size: $e.m_size
)
)
)
}
......@@ -3,16 +3,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-59408561-3', 'auto');
ga('send', 'pageview');
</script>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
......
set(SOURCE
${SOURCE}
${CMAKE_CURRENT_SOURCE_DIR}/autodiff.cpp
PARENT_SCOPE
)
set(HEADER
${HEADER}
PARENT_SCOPE
)
\ No newline at end of file
add_subdirectory(Data)
add_subdirectory(Mesh)
add_subdirectory(Io)
add_subdirectory(Solver)
add_subdirectory(NonlinearSolver)
add_subdirectory(Autodiff)
add_subdirectory(Partitioner)
add_subdirectory(Misc)
add_subdirectory(Headers)
set(SOLVER_DEFINITIONS ${SOLVER_DEFINITIONS} PARENT_SCOPE)
set(SOURCE ${SOURCE} PARENT_SCOPE)
set(HEADER ${HEADER} PARENT_SCOPE)
set(SOURCE
${SOURCE}
${CMAKE_CURRENT_SOURCE_DIR}/storage.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tag.cpp
PARENT_SCOPE
)
set(HEADER
${HEADER}
PARENT_SCOPE
)
\ No newline at end of file
#include "inmost.h"
#if defined(USE_MESH)
#include <new>
namespace INMOST
{
Storage & Storage::operator =(Storage const & other)
{
handle = other.handle;
if( handle_link != NULL ) *handle_link = handle;
//else handle_link = other.handle_link; //if other have remote link this will copy this link and current will also be remote
m_link = other.m_link;
return *this;
}
Element Storage::reference_array::operator [](size_type n)
{
return Element(m,&shell<HandleType>::operator[](n));
}
Element Storage::reference_array::operator [](size_type n) const
{
return Element(m,shell<HandleType>::operator[](n));
}
Element Storage::reference_array::iterator::operator->()
{
return Element(m,&shell<HandleType>::iterator::operator *());
}
Element Storage::reference_array::const_iterator::operator->()
{
return Element(m,shell<HandleType>::const_iterator::operator *());
}
Element Storage::reference_array::reverse_iterator::operator->()
{
return Element(m,&shell<HandleType>::reverse_iterator::operator *());
}
Element Storage::reference_array::const_reverse_iterator::operator->()
{
return Element(m,shell<HandleType>::const_reverse_iterator::operator *());
}
void Storage::reference_array::push_back(const Storage & ref)
{
shell<reference>::push_back(ref->GetHandle());
}
}
#endif
......@@ -11,6 +11,7 @@ namespace INMOST
case DATA_INTEGER: return "INTEGER";
case DATA_BULK: return "BULK";
case DATA_REFERENCE: return "REFERENCE";
case DATA_VARIABLE: return "VARIABLE";
}
return "UNKNOWN";
}
......@@ -24,6 +25,7 @@ namespace INMOST
case DATA_INTEGER: return sizeof(INMOST_DATA_INTEGER_TYPE);
case DATA_REAL: return sizeof(INMOST_DATA_REAL_TYPE);
case DATA_REFERENCE: return sizeof(HandleType);
case DATA_VARIABLE: return sizeof(variable);
}
return 0;
}
......@@ -37,25 +39,47 @@ namespace INMOST
case DATA_INTEGER: return sizeof(inner_integer_array);
case DATA_BULK: return sizeof(inner_bulk_array);
case DATA_REFERENCE: return sizeof(inner_reference_array);
case DATA_VARIABLE: return sizeof(inner_variable_array);
}
return 0;
}
Tag::~Tag()
{
mem = NULL;
}
Tag::Tag()
{
mem = NULL;
}
Tag::Tag(const Tag & other)
{
mem = other.mem;
}
void TagManager::CopyData(const Tag & t, void * adata, const void * bdata)
{
INMOST_DATA_ENUM_TYPE data_size = t.GetSize();
INMOST_DATA_ENUM_TYPE bytes = t.GetBytesSize();
DataType type = t.GetDataType();
if( data_size == ENUMUNDEF ) //variable size array
{
DataType type = t.GetDataType();
if( adata != NULL ) TagManager::DestroyVariableData(t,adata);
if( type == DATA_REAL ) new (adata) inner_real_array (*static_cast<const inner_real_array * >(bdata));
else if( type == DATA_INTEGER ) new (adata) inner_integer_array (*static_cast<const inner_integer_array * >(bdata));
else if( type == DATA_BULK ) new (adata) inner_bulk_array (*static_cast<const inner_bulk_array * >(bdata));
else if( type == DATA_REFERENCE ) new (adata) inner_reference_array(*static_cast<const inner_reference_array * >(bdata));
else if( type == DATA_VARIABLE ) new (adata) inner_variable_array (*static_cast<const inner_variable_array * >(bdata));
}
else if( type == DATA_VARIABLE ) //have to call constructor
{
for(INMOST_DATA_ENUM_TYPE k = 0; k < data_size; ++k)
new (static_cast<variable *>(adata)+k) variable(*(static_cast<const variable *>(bdata)+k));
}
else // fixed size array
memcpy(adata,bdata,data_size*bytes);
}
......@@ -85,12 +109,17 @@ namespace INMOST
(*static_cast<inner_reference_array *> (adata)).~inner_reference_array();
new (adata) inner_reference_array();
}
else if( type == DATA_VARIABLE )
{
(*static_cast<inner_variable_array *> (adata)).~inner_variable_array();
new (adata) inner_variable_array();
}
}
}
TagMemory::TagMemory(Mesh * m, const TagMemory & other)
{
for(int i = 0; i < __NET; i++)
for(int i = 0; i < NUM_ELEMENT_TYPS; i++)
{
pos[i] = other.pos[i];
sparse[i] = other.sparse[i];
......@@ -106,7 +135,7 @@ namespace INMOST
TagMemory & TagMemory::operator =(TagMemory const & other)
{
for(int i = 0; i < __NET; i++)
for(int i = 0; i < NUM_ELEMENT_TYPS; i++)
{
pos[i] = other.pos[i];
sparse[i] = other.sparse[i];
......@@ -121,14 +150,9 @@ namespace INMOST
return *this;
}
TagMemory::~TagMemory()
{
}
TagMemory::TagMemory()
{
for(int i = 0; i < __NET; i++)
for(int i = 0; i < NUM_ELEMENT_TYPS; i++)
{
pos[i] = ENUMUNDEF;
sparse[i] = false;
......@@ -139,7 +163,7 @@ namespace INMOST
Tag::Tag(Mesh * m, std::string name, DataType _dtype,INMOST_DATA_ENUM_TYPE size)
{
mem = new TagMemory();
for(int i = 0; i < __NET; i++)
for(int i = 0; i < NUM_ELEMENT_TYPS; i++)
{
mem->pos[i] = ENUMUNDEF;
mem->sparse[i] = false;
......@@ -152,7 +176,8 @@ namespace INMOST
case DATA_BULK: mem->bulk_data_type = INMOST_MPI_DATA_BULK_TYPE; break;
case DATA_REAL: mem->bulk_data_type = INMOST_MPI_DATA_REAL_TYPE; break;
case DATA_INTEGER: mem->bulk_data_type = INMOST_MPI_DATA_INTEGER_TYPE; break;
case DATA_REFERENCE: mem->bulk_data_type = INMOST_MPI_DATA_ENUM_TYPE; break;
case DATA_REFERENCE: mem->bulk_data_type = INMOST_MPI_DATA_ENUM_TYPE; break;
case DATA_VARIABLE: mem->bulk_data_type = INMOST_MPI_DATA_REAL_TYPE; break; //mixture of types, should not get here
}
mem->bytes_size = DataTypeBytesSize(mem->dtype);
if(mem->size == ENUMUNDEF )
......@@ -242,6 +267,7 @@ namespace INMOST
bool need_sparse[6] = {false,false,false,false,false,false};
#endif
for(tag_array_type::size_type i = 0; i < tags.size(); i++)
{
if( tags[i].GetTagName() == name )
{
assert( tags[i].GetDataType() == dtype && (size == ENUMUNDEF || size == tags[i].GetSize()) );
......@@ -252,10 +278,16 @@ namespace INMOST
new_tag = tags[i];
break;
}
}
if( !new_tag.isValid() )
{
new_tag = Tag(m,name,dtype,size);
tags.push_back(new_tag);
#if defined(USE_OMP)
#pragma omp critical
#endif
{
tags.push_back(new_tag);
}
}
for(ElementType mask = NODE; mask <= MESH; mask = mask << 1)
{
......@@ -271,14 +303,20 @@ namespace INMOST
}
else
{
INMOST_DATA_ENUM_TYPE new_pos = static_cast<INMOST_DATA_ENUM_TYPE>(dense_data.size());
if( !empty_dense_data.empty() )
{
new_pos = empty_dense_data.back();
empty_dense_data.pop_back();
dense_data[new_pos] = dense_sub_type(new_tag.GetRecordSize());
}
else dense_data.push_back(dense_sub_type(new_tag.GetRecordSize()));
INMOST_DATA_ENUM_TYPE new_pos = ENUMUNDEF;
#if defined(USE_OMP)
#pragma omp critical
#endif
{
new_pos = static_cast<INMOST_DATA_ENUM_TYPE>(dense_data.size());
if( !empty_dense_data.empty() )
{
new_pos = empty_dense_data.back();
empty_dense_data.pop_back();
dense_data[new_pos] = dense_sub_type(new_tag.GetRecordSize());
}
else dense_data.push_back(dense_sub_type(new_tag.GetRecordSize()));
}
new_tag.SetPosition(new_pos,mask);
INMOST_DATA_ENUM_TYPE new_size = dynamic_cast<Mesh *>(this)->GetArrayCapacity(ElementNum(mask));
if( new_size < 1024 && mask != MESH ) new_size = 1024;
......@@ -294,7 +332,12 @@ namespace INMOST
INMOST_DATA_ENUM_TYPE new_size = dynamic_cast<Mesh *>(this)->GetArrayCapacity(j);
if( new_size < 1024 && j != ElementNum(MESH) ) new_size = 1024;
if( new_size != 1 && j == ElementNum(MESH) ) new_size = 1;
sparse_data[j].resize(new_size);
#if defined(USE_OMP)
#pragma omp critical
#endif
{
sparse_data[j].resize(new_size);
}
}
#endif
return new_tag;
......@@ -329,8 +372,8 @@ namespace INMOST
{
if( !tag.isSparse(mask) )
{
dense_data[tpos].clear(); //here all data should be deleted
empty_dense_data.push_back(tpos);
dense_data[tpos].clear(); //here all data should be deleted
empty_dense_data.push_back(tpos);
}
#if !defined(LAZY_SPARSE_ALLOCATION)
else was_sparse[ElementNum(mask)] = true;
......@@ -344,28 +387,27 @@ namespace INMOST
bool flag = false;
#if !defined(LAZY_SPARSE_ALLOCATION)
bool have_sparse[6] = {false,false,false,false,false,false};
for(int j = 0; j < 6; j++)
{
for(tag_array_type::size_type i = 0; i < tags.size() && !have_sparse[j]; i++)
if( tags[i] != tag && tags[i].isSparseByDim(j) ) have_sparse[j] = true;
}
for(int j = 0; j < 6; j++)
if( was_sparse[j] && !have_sparse[j] )
sparse_data[j].clear();
#endif
for(tag_array_type::size_type i = 0; i < tags.size(); i++)
{
#if !defined(LAZY_SPARSE_ALLOCATION)
for(int j = 0; j < 6; j++)
if( tags[i].isSparseByDim(j) ) have_sparse[j] = true;
#endif
if( tags[i] == tag )
{
tags.erase(tags.begin()+i);
flag = true;
tags.erase(tags.begin()+i);
flag = true;
break;
}
}
assert(flag);
delete tag.mem;
tag.mem = NULL;
#if !defined(LAZY_SPARSE_ALLOCATION)
for(int j = 0; j < 6; j++)
if( was_sparse[j] && !have_sparse[j] )
sparse_data[j].clear();
#endif
}
return tag;
}
......@@ -439,10 +481,16 @@ namespace INMOST
case DATA_INTEGER: for(INMOST_DATA_ENUM_TYPE it = new_size; it < old_size; ++it) {void * p = static_cast<void *>(&arr[it]); if( p != NULL ) (*static_cast<inner_integer_array *>( p )).~inner_integer_array(); } break;
case DATA_BULK: for(INMOST_DATA_ENUM_TYPE it = new_size; it < old_size; ++it) {void * p = static_cast<void *>(&arr[it]); if( p != NULL ) (*static_cast<inner_bulk_array *>( p )).~inner_bulk_array(); } break;
case DATA_REFERENCE: for(INMOST_DATA_ENUM_TYPE it = new_size; it < old_size; ++it) {void * p = static_cast<void *>(&arr[it]); if( p != NULL ) (*static_cast<inner_reference_array *>( p )).~inner_reference_array();} break;
case DATA_VARIABLE: for(INMOST_DATA_ENUM_TYPE it = new_size; it < old_size; ++it) {void * p = static_cast<void *>(&arr[it]); if( p != NULL ) (*static_cast<inner_variable_array *>( p )).~inner_variable_array(); } break;
}
}
}
arr.resize(new_size);
#if defined(USE_OMP)
#pragma omp critical
#endif
{
arr.resize(new_size);
}
if( data_size == ENUMUNDEF ) //Initialize variable-sized data
{
switch(data_type)
......@@ -451,12 +499,10 @@ namespace INMOST
case DATA_INTEGER: for(INMOST_DATA_ENUM_TYPE it = old_size; it < new_size; ++it) new ( &arr[it] ) inner_integer_array(); break;
case DATA_BULK: for(INMOST_DATA_ENUM_TYPE it = old_size; it < new_size; ++it) new ( &arr[it] ) inner_bulk_array(); break;
case DATA_REFERENCE: for(INMOST_DATA_ENUM_TYPE it = old_size; it < new_size; ++it) new ( &arr[it] ) inner_reference_array(); break;
case DATA_VARIABLE: for(INMOST_DATA_ENUM_TYPE it = old_size; it < new_size; ++it) new ( &arr[it] ) inner_variable_array(); break;
}
}
}
}
#endif
set(SOURCE
${SOURCE}
PARENT_SCOPE
)
set(HEADER
${HEADER}
${CMAKE_CURRENT_SOURCE_DIR}/inmost.h
${CMAKE_CURRENT_SOURCE_DIR}/inmost_options_cmake.h
${CMAKE_CURRENT_SOURCE_DIR}/inmost_common.h
${CMAKE_CURRENT_SOURCE_DIR}/inmost_data.h
${CMAKE_CURRENT_SOURCE_DIR}/inmost_mesh.h
${CMAKE_CURRENT_SOURCE_DIR}/inmost_solver.h
${CMAKE_CURRENT_SOURCE_DIR}/inmost_partitioner.h
${CMAKE_CURRENT_SOURCE_DIR}/inmost_autodiff.h
${CMAKE_CURRENT_SOURCE_DIR}/inmost_expression.h
${CMAKE_CURRENT_SOURCE_DIR}/inmost_variable.h
${CMAKE_CURRENT_SOURCE_DIR}/inmost_sparse.h
${CMAKE_CURRENT_SOURCE_DIR}/inmost_nonlinear.h
${CMAKE_CURRENT_SOURCE_DIR}/container.hpp
PARENT_SCOPE
)
\ No newline at end of file
......@@ -16,6 +16,9 @@
//#define OUT_OF_RANGE
//TODO
// 1. change to uniform size_type instead of size_t, make it INMOST_DATA_ENUM_TYPE
template<class element, class T1> struct isInputRandomIterators
{
static void constraints(T1 a, T1 b) { /*element x = static_cast<element>(*a); (void)x;*/ ++a; (void)a++; a==a; a!=a; a-b; }
......