Commit b73dc746 authored by Kirill Terekhov's avatar Kirill Terekhov

Huge update

Huge update involving update of underlying data representation and
elements management. Different interaction with iterators. New
ElementSet representation.  Some annotation for documentation is added.
New data structures. Examples require update. (check
examples/CMakeLists.txt)
parent b214f48f
......@@ -20,7 +20,9 @@ set(SOURCE solver.cpp
element.cpp
mesh_parallel.cpp
modify.cpp
autodiff.cpp)
earray.cpp
comparator.cpp
autodiff.cpp)
set(HEADER inmost.h
inmost_options_cmake.h
inmost_common.h
......
mesh + !partitioner + !domain + solvers + +/-nonlinear solvers + autodiff + !system handler
:
0) () , data()
1) () erase array , resize'
2) () ReferenceArray
3) () char, short, - , -
4) ()
5) ( )
6) ()
7) () chunk_bulk_array - chunk_array - ,
8) ()
8.1)
10) ()
10.-1) () Element getNodes,getEdges,getFaces,getCells
10.0) (, ) array,
10.1) () adjacent ( ID , )
10.1.0) (, , 10.6) - array ( reference_array) dynarray ( )
10.1.1) ()
10.2) () ElementSet - , LowConn , ,
HighConn , 1- - , - , - ( INMOST_experimental)
tag_set_size, , LowConn
?
,
10.2.0) () ,
:
- , , , , insert
- array, , swap array
,
10.2.1) () - , , , 10.1
- ,
10.2.2) () ApplyModification
10.2.3) () VTK
10.2) () ID
10.3) () Cell, Face, Edge, Node, ElementSet - , ID
10.4) () Cell,Face,Edge,Node,ElementSet ID
10.5) () reference_array
10.6) () createCell, CreateFace.. - TieElement new, 10.3
11) () Markers, HighConn, LowConn - TagManager, , ,
26) ()
26.1) ( ) radix ( INMOST_experimental)
25*n 8- , 16
17*n 11- , 131
27) () Read* pmf,
28) () std::vector array
29) () std::vector array
31) () TagManager & TagManager::assign(Mesh * m, TagManager const & other)
33) () ElementNum, ElementType 6
34) () Storage ,
36) ( ) , Storage Mesh
50) () container.hpp enumerator size_type
51) () container.hpp ( iterator_category?)
41) ( ) HighConn, LowConn ,
44) ( ) PackElementsData tag
46) ( ) . ,
14) ReferenceArray?
16) parallel_storage
17) ?
18)
19) ( , )
20)
21) /- (kd examples/OldDrawGrid)
22) ResolveShared
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 ,
40) ?
42) Inside discr_common.cpp
43) RestoreCellNodes?
45) ?
. ( )
47) , , ?
49) -
,
ResolveShared
ModificationResolve
52) , radix big-endian
53) SortByGlobalID, globalid
54) ( unit tests)
7.MSPP: : , ,
8.MSPP:
9.MSPP: visual studio
10.MSPP: ( )
11.
12. (, )
12. MSPP: Mesh
13. MSPP: Redistribute!!! ExchangeGhost
13. INMOST / MMTK = Mathematical Modelling ToolKit / NSTK
last_created_element -
1) - ,
( ),
-
,
-
2) small_hash -> dynarray
3)
4)
5) parent()
6)
7) , []
8)
9) ,
( )
10) ,
11) LLVM asmjit
12) openmp
13) opencl , openmp
14)
1) -
1)
2) ILUC2
3) /,
4) E,F
5) EU^-1 L^-1F
6)
7) (openmp)
8) (openmp) EU^-1, L^-1F
9) nicole spillane
10) ,
11) amls
12)
solver:
read mc64
read nested dissection
try to postpone ReorderEF to the end of run
5.MSPP:
6.MSPP:
6.0 bicgs(l)
6.0 OrderInfo -> ASM_preconditioner?
6.0.1 OrderInfo.PrepareMatrix(A,levels) -> ASM_preconditioner(A,levels) : Method
6.0.3 OrderInfo.PrepareVector(vector) -> Matrix.PrepareVector(vector)
6.0.4 OrderInfo.Update(vector) -> Matrix.Update(vector)
6.0.5 orderInfo.Accumulate(vector) -> Matrix.Accumulate(vector)
6.1 (, MPI_Waitall->MPI_Waitsome)
6.2 Update(vector) -> UpdateBegin, UpdateEnd, , (INIT,PREC,MATVEC)
6.3 (?) ilu2 ( superlu?)
6.3.1
info->PrepareMatrix(A,0)
6.3.2
6.4 tau
6.5
6.6 superlu
6.7 - ..
//FOR 2D
// Node -> Vertex
// Edge -> Vertex
......
......@@ -35,7 +35,7 @@ namespace INMOST
hi = (char *) base + width * (num - 1);
recurse:
size = (hi - lo) / width + 1;
size = static_cast<unsigned>((hi - lo) / width) + 1;
if (size <= CUTOFF)
{
......
......@@ -109,7 +109,7 @@ namespace INMOST
else if (it->op >= AD_TABLE)
{
lval = var.values[voffset+it->left.i];
var.values[doffset+it->left.i] += var.values[doffset+k] * reg_tables[it->op]->get_derivative(lval);
var.values[doffset+it->left.i] += var.values[doffset+k] * reg_tables[it->op-AD_TABLE]->get_derivative(lval);
}
else if (it->op >= AD_STNCL)
{
......@@ -171,8 +171,8 @@ namespace INMOST
case AD_MES: assert(!(e->GetElementType() & (ESET | MESH))); m->GetGeometricData(static_cast<Element *>(e), MEASURE, &var.values[offset+k]); break;
case AD_VAL: var.values[offset+k] = var.values[offset+it->left.i]; break;
default:
if (it->op >= AD_FUNC) var.values[offset+k] = reg_funcs[it->op].func(e, user_data);
else if (it->op >= AD_TABLE) var.values[offset+k] = reg_tables[it->op]->get_value(var.values[offset+it->left.i]);
if (it->op >= AD_FUNC) var.values[offset+k] = reg_funcs[it->op-AD_FUNC].func(e, user_data);
else if (it->op >= AD_TABLE) var.values[offset+k] = reg_tables[it->op-AD_TABLE]->get_value(var.values[offset+it->left.i]);
else if (it->op >= AD_STNCL)
{
it->left.e->current_stencil.clear();
......@@ -211,7 +211,7 @@ namespace INMOST
}
#else
INMOST_DATA_REAL_TYPE Automatizator::DerivativePrecompute(const expr & var, Storage * e, precomp_values_t & values, void * user_data)
INMOST_DATA_REAL_TYPE Automatizator::DerivativePrecompute(const expr & var, const Storage & e, precomp_values_t & values, void * user_data)
{
assert(var.op != AD_NONE);
INMOST_DATA_REAL_TYPE lval, rval, ret = 0.0;
......@@ -290,7 +290,7 @@ namespace INMOST
return var.coef;
case AD_MES:
assert(!(e->GetElementType() & (ESET | MESH)));
m->GetGeometricData(static_cast<Element *>(e), MEASURE, &ret);
m->GetGeometricData(e->GetHandle(), MEASURE, &ret);
return ret*var.coef;
case AD_VAL:
lval = DerivativePrecompute(*var.left, e, values, user_data);
......@@ -300,26 +300,26 @@ namespace INMOST
}
if (var.op >= AD_FUNC)
{
ret = reg_funcs[var.op].func(e, user_data);
ret = reg_funcs[var.op-AD_FUNC].func(e, user_data);
return ret*var.coef;
}
else if (var.op >= AD_TABLE)
{
lval = DerivativePrecompute(*var.left, e, values, user_data);
values.push_back(lval);
ret = reg_tables[var.op]->get_value(lval);
ret = reg_tables[var.op-AD_TABLE]->get_value(lval);
return ret*var.coef;
}
else if (var.op >= AD_STNCL)
{
stencil_kind_domain & st = reg_stencils[var.op];
stencil_kind_domain & st = reg_stencils[var.op-AD_STNCL];
assert(st.domainmask == 0 || e->GetMarker(st.domainmask));
if (st.kind == 0)
{
Storage::reference_array elems = e->ReferenceArray(static_cast<stencil_tag *>(st.link)->elements);
Storage::real_array coefs = e->RealArray(static_cast<stencil_tag *>(st.link)->coefs);
assert(elems.size() == coefs.size());
for (INMOST_DATA_ENUM_TYPE k = 0; k < elems.size(); ++k) if( elems[k] != NULL )
for (INMOST_DATA_ENUM_TYPE k = 0; k < elems.size(); ++k) if( elems.at(k) != InvalidHandle() )
{
lval = DerivativePrecompute(*var.left, elems[k], values, user_data);
ret += lval * coefs[k];
......@@ -331,7 +331,7 @@ namespace INMOST
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 )
{
lval = DerivativePrecompute(*var.left, get_st[k].first, values, user_data);
lval = DerivativePrecompute(*var.left, Storage(m,get_st[k].first), values, user_data);
ret += lval * get_st[k].second;
}
}
......@@ -353,7 +353,7 @@ namespace INMOST
return 0.0;
}
//! returns offset from the end of precomputed values
void Automatizator::DerivativeFill(const expr & var, Storage * e, Solver::Row & entries, precomp_values_t & values, INMOST_DATA_REAL_TYPE multval, void * user_data)
void Automatizator::DerivativeFill(const expr & var, const Storage & e, Solver::Row & entries, precomp_values_t & values, INMOST_DATA_REAL_TYPE multval, void * user_data)
{
assert(var.op != AD_NONE);
INMOST_DATA_REAL_TYPE lval, rval, ret;
......@@ -435,27 +435,27 @@ namespace INMOST
else if (var.op >= AD_TABLE)
{
lval = values.back(); values.pop_back();
DerivativeFill(*var.left, e, entries, values, multval * var.coef * reg_tables[var.op]->get_derivative(lval), user_data);
DerivativeFill(*var.left, e, entries, values, multval * var.coef * reg_tables[var.op-AD_TABLE]->get_derivative(lval), user_data);
return;
}
else if (var.op >= AD_STNCL)
{
stencil_kind_domain & st = reg_stencils[var.op];
stencil_kind_domain & st = reg_stencils[var.op-AD_STNCL];
assert(st.domainmask == 0 || e->GetMarker(st.domainmask));
if (st.kind == 0)
{
Storage::reference_array elems = e->ReferenceArray(static_cast<stencil_tag *>(st.link)->elements);
Storage::real_array coefs = e->RealArray(static_cast<stencil_tag *>(st.link)->coefs);
assert(elems.size() == coefs.size());
for (INMOST_DATA_ENUM_TYPE k = elems.size(); k > 0; --k) if( elems[k-1] != NULL )
for (INMOST_DATA_ENUM_TYPE k = elems.size(); k > 0; --k) if( elems.at(k-1) != InvalidHandle() )
DerivativeFill(*var.left, elems[k - 1], entries, values, var.coef * coefs[k - 1] * multval, user_data);
}
else if (st.kind == 1)
{
stencil_pairs get_st;
reinterpret_cast<stencil_callback>(st.link)(e, get_st, user_data);
for (INMOST_DATA_ENUM_TYPE k = get_st.size(); k > 0; --k) if( get_st[k-1].first != NULL )
DerivativeFill(*var.left, get_st[k - 1].first, entries, values, var.coef * get_st[k - 1].second*multval, 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 )
DerivativeFill(*var.left, Storage(m,get_st[k - 1].first), entries, values, var.coef * get_st[k - 1].second*multval, user_data);
}
return;
}
......@@ -472,7 +472,7 @@ namespace INMOST
assert(false);
return;
}
INMOST_DATA_REAL_TYPE Automatizator::Evaluate(const expr & var, Storage * e, void * user_data)
INMOST_DATA_REAL_TYPE Automatizator::Evaluate(const expr & var, const Storage & e, void * user_data)
{
assert(var.op != AD_NONE);
switch (var.op)
......@@ -493,22 +493,22 @@ namespace INMOST
case AD_SIN: return ::sin(Evaluate(*var.left, e, user_data))*var.coef;
case AD_COS: return ::cos(Evaluate(*var.left, e, user_data))*var.coef;
case AD_CONST: return var.coef;
case AD_MES: assert(!(e->GetElementType() & (ESET | MESH))); Storage::real ret; m->GetGeometricData(static_cast<Element *>(e), MEASURE, &ret); return ret*var.coef;
case AD_MES: assert(!(e->GetElementType() & (ESET | MESH))); Storage::real ret; m->GetGeometricData(e->GetHandle(), MEASURE, &ret); return ret*var.coef;
case AD_VAL: return Evaluate(*var.left,e,user_data)*var.coef;
}
if (var.op >= AD_FUNC) return reg_funcs[var.op].func(e, user_data);
if (var.op >= AD_TABLE) return reg_tables[var.op]->get_value(Evaluate(*var.left, e, user_data))*var.coef;
if (var.op >= AD_FUNC) return reg_funcs[var.op-AD_FUNC].func(e, user_data);
if (var.op >= AD_TABLE) return reg_tables[var.op-AD_TABLE]->get_value(Evaluate(*var.left, e, user_data))*var.coef;
if (var.op >= AD_STNCL)
{
INMOST_DATA_REAL_TYPE ret = 0.0;
stencil_kind_domain & st = reg_stencils[var.op];
stencil_kind_domain & st = reg_stencils[var.op-AD_STNCL];
assert(st.domainmask == 0 || e->GetMarker(st.domainmask));
if (st.kind == 0)
{
Storage::reference_array elems = e->ReferenceArray(static_cast<stencil_tag *>(st.link)->elements);
Storage::real_array coefs = e->RealArray(static_cast<stencil_tag *>(st.link)->coefs);
assert(elems.size() == coefs.size());
for (INMOST_DATA_ENUM_TYPE k = 0; k < elems.size(); ++k) if( elems[k] != NULL )
for (INMOST_DATA_ENUM_TYPE k = 0; k < elems.size(); ++k) if( elems.at(k) != InvalidHandle() )
ret += var.coef * Evaluate(*var.left, elems[k], user_data) * coefs[k];
}
else if (st.kind == 1)
......@@ -516,7 +516,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 )
ret += var.coef * Evaluate(*var.left, get_st[k].first, user_data) * get_st[k].second;
ret += var.coef * Evaluate(*var.left, Storage(m,get_st[k].first), user_data) * get_st[k].second;
}
return ret;
}
......@@ -526,7 +526,7 @@ namespace INMOST
return 0.0;
}
INMOST_DATA_REAL_TYPE Automatizator::Derivative(const expr & var, Storage * e, Solver::Row & out, Storage::real multiply, void * user_data)
INMOST_DATA_REAL_TYPE Automatizator::Derivative(const expr & var, const Storage & e, Solver::Row & out, Storage::real multiply, void * user_data)
{
INMOST_DATA_REAL_TYPE ret;
precomp_values_t values;
......@@ -542,27 +542,27 @@ namespace INMOST
index_tags[k].indices = m->DeleteTag(index_tags[k].indices);
for (table_type::iterator it = reg_tables.begin(); it != reg_tables.end(); ++it)
{
delete[] it->second->args;
delete[] it->second->vals;
delete it->second;
delete[] (*it)->args;
delete[] (*it)->vals;
delete (*it);
}
for (stencil_type::iterator it = reg_stencils.begin(); it != reg_stencils.end(); ++it)
if (it->second.kind == 0)
delete static_cast<stencil_tag *>(it->second.link);
if (it->kind == 0)
delete static_cast<stencil_tag *>(it->link);
}
INMOST_DATA_ENUM_TYPE Automatizator::RegisterFunc(std::string name, func_callback func)
{
INMOST_DATA_ENUM_TYPE ret = reg_funcs.size() + AD_FUNC;
INMOST_DATA_ENUM_TYPE ret = static_cast<INMOST_DATA_ENUM_TYPE>(reg_funcs.size()) + AD_FUNC;
func_name_callback v;
v.name = name;
v.func = func;
reg_funcs[ret] = v;
reg_funcs.push_back(v);
return ret;
}
//register stencil that can be got from tags
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStencil(std::string name, Tag elements_tag, Tag coefs_tag, MarkerType domain_mask)
{
INMOST_DATA_ENUM_TYPE ret = reg_stencils.size() + AD_STNCL;
INMOST_DATA_ENUM_TYPE ret = static_cast<INMOST_DATA_ENUM_TYPE>(reg_stencils.size()) + AD_STNCL;
stencil_kind_domain st;
stencil_tag * save = new stencil_tag;
st.name = name;
......@@ -571,24 +571,24 @@ namespace INMOST
st.kind = 0;
st.link = static_cast<void *>(save);
st.domainmask = domain_mask;
reg_stencils[ret] = st;
reg_stencils.push_back(st);
return ret;
}
//register stencil that can be got from function
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStencil(std::string name, stencil_callback func, MarkerType domain_mask)
{
INMOST_DATA_ENUM_TYPE ret = reg_stencils.size() + AD_STNCL;
INMOST_DATA_ENUM_TYPE ret = static_cast<INMOST_DATA_ENUM_TYPE>(reg_stencils.size()) + AD_STNCL;
stencil_kind_domain st;
st.name = name;
st.kind = 1;
st.link = reinterpret_cast<void *>(func);
st.domainmask = domain_mask;
reg_stencils[ret] = st;
reg_stencils.push_back(st);
return ret;
}
INMOST_DATA_ENUM_TYPE Automatizator::RegisterTable(std::string name, INMOST_DATA_REAL_TYPE * Arguments, INMOST_DATA_REAL_TYPE * Values, INMOST_DATA_ENUM_TYPE size)
{
INMOST_DATA_ENUM_TYPE ret = reg_tables.size() + AD_TABLE;
INMOST_DATA_ENUM_TYPE ret = static_cast<INMOST_DATA_ENUM_TYPE>(reg_tables.size()) + AD_TABLE;
table_ptr t = new table;
t->name = name;
t->args = new INMOST_DATA_REAL_TYPE[size];
......@@ -596,7 +596,7 @@ namespace INMOST
t->vals = new INMOST_DATA_REAL_TYPE[size];
memcpy(t->vals, Values, sizeof(INMOST_DATA_REAL_TYPE)*size);
t->size = size;
reg_tables[ret] = t;
reg_tables.push_back(t);
return ret;
}
/// set data of tag t defined on domain_mask to be dynamic data
......@@ -613,8 +613,8 @@ namespace INMOST
if (t.isSparse(q)) sparse |= q;
}
p.indices = m->CreateTag(t.GetTagName() + "_index", DATA_INTEGER, def, sparse, t.GetSize());
INMOST_DATA_ENUM_TYPE ret = reg_tags.size() + AD_TAG;
reg_tags[ret] = p;
INMOST_DATA_ENUM_TYPE ret = static_cast<INMOST_DATA_ENUM_TYPE>(reg_tags.size()) + AD_TAG;
reg_tags.push_back(p);
index_tags.push_back(p);
return ret;
}
......@@ -628,7 +628,7 @@ namespace INMOST
for (ElementType etype = NODE; etype <= MESH; etype = etype << 1)
if (it->indices.isDefined(etype) && it->indices.isSparse(etype))
{
for (Mesh::base_iterator jt = m->Begin(etype); jt != m->End(); ++jt)
for (Mesh::iteratorStorage jt = m->Begin(etype); jt != m->End(); ++jt)
jt->DelData(it->indices);
}
}
......@@ -644,8 +644,8 @@ namespace INMOST
{
if (!it->indices.isSparse(etype))
{
for (Mesh::base_iterator jt = m->Begin(etype); jt != m->End(); ++jt)
if (((etype & paralleltypes) && static_cast<Element *>(&*jt)->GetStatus() != Element::Ghost) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask)))
for (Mesh::iteratorElement jt = m->BeginElement(etype); jt != m->EndElement(); ++jt)
if ((!(etype & paralleltypes) || ((etype & paralleltypes) && jt->GetStatus() != Element::Ghost)) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask)))
{
Storage::integer_array indarr = jt->IntegerArray(it->indices);
indarr.resize(jt->RealArray(it->d.t).size());
......@@ -655,8 +655,8 @@ namespace INMOST
}
else
{
for (Mesh::base_iterator jt = m->Begin(etype); jt != m->End(); ++jt)
if (((etype & paralleltypes) && static_cast<Element *>(&*jt)->GetStatus() != Element::Ghost) && (jt->HaveData(it->d.t) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask))))
for (Mesh::iteratorElement jt = m->BeginElement(etype); jt != m->EndElement(); ++jt)
if ((!(etype & paralleltypes) || ((etype & paralleltypes) && jt->GetStatus() != Element::Ghost)) && (jt->HaveData(it->d.t) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask))))
{
Storage::integer_array indarr = jt->IntegerArray(it->indices);
indarr.resize(jt->RealArray(it->d.t).size());
......@@ -669,8 +669,8 @@ namespace INMOST
{
if (!it->indices.isSparse(etype))
{
for (Mesh::base_iterator jt = m->Begin(etype); jt != m->End(); ++jt)
if (((etype & paralleltypes) && static_cast<Element *>(&*jt)->GetStatus() != Element::Ghost) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask)))
for (Mesh::iteratorElement jt = m->BeginElement(etype); jt != m->EndElement(); ++jt)
if ((!(etype & paralleltypes) || ((etype & paralleltypes) && jt->GetStatus() != Element::Ghost)) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask)))
{
Storage::integer_array indarr = jt->IntegerArray(it->indices);
for (Storage::integer_array::iterator qt = indarr.begin(); qt != indarr.end(); ++qt)
......@@ -679,8 +679,8 @@ namespace INMOST
}
else
{
for (Mesh::base_iterator jt = m->Begin(etype); jt != m->End(); ++jt)
if (((etype & paralleltypes) && static_cast<Element *>(&*jt)->GetStatus() != Element::Ghost) && (jt->HaveData(it->d.t) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask))))
for (Mesh::iteratorElement jt = m->BeginElement(etype); jt != m->EndElement(); ++jt)
if ((!(etype & paralleltypes) || ((etype & paralleltypes) && jt->GetStatus() != Element::Ghost)) && (jt->HaveData(it->d.t) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask))))
{
Storage::integer_array indarr = jt->IntegerArray(it->indices);
for (Storage::integer_array::iterator qt = indarr.begin(); qt != indarr.end(); ++qt)
......@@ -708,8 +708,8 @@ namespace INMOST
{
if (!it->indices.isSparse(etype))
{
for (Mesh::base_iterator jt = m->Begin(etype); jt != m->End(); ++jt)
if (((etype & paralleltypes) && static_cast<Element *>(&*jt)->GetStatus() != Element::Ghost) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask)))
for (Mesh::iteratorElement jt = m->BeginElement(etype); jt != m->EndElement(); ++jt)
if ((!(etype & paralleltypes) || ((etype & paralleltypes) && jt->GetStatus() != Element::Ghost)) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask)))
{
Storage::integer_array indarr = jt->IntegerArray(it->indices);
for (Storage::integer_array::iterator qt = indarr.begin(); qt != indarr.end(); ++qt)
......@@ -718,8 +718,8 @@ namespace INMOST
}
else
{
for (Mesh::base_iterator jt = m->Begin(etype); jt != m->End(); ++jt)
if (((etype & paralleltypes) && static_cast<Element *>(&*jt)->GetStatus() != Element::Ghost) && (jt->HaveData(it->d.t) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask))))
for (Mesh::iteratorElement jt = m->BeginElement(etype); jt != m->EndElement(); ++jt)
if ((!(etype & paralleltypes) || ((etype & paralleltypes) && jt->GetStatus() != Element::Ghost)) && (jt->HaveData(it->d.t) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask))))
{
Storage::integer_array indarr = jt->IntegerArray(it->indices);
indarr.resize(jt->RealArray(it->d.t).size());
......@@ -732,8 +732,8 @@ namespace INMOST
{
if (!it->indices.isSparse(etype))
{
for (Mesh::base_iterator jt = m->Begin(etype); jt != m->End(); ++jt)
if (((etype & paralleltypes) && static_cast<Element *>(&*jt)->GetStatus() != Element::Ghost) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask)))
for (Mesh::iteratorElement jt = m->BeginElement(etype); jt != m->EndElement(); ++jt)
if ((!(etype & paralleltypes) || ((etype & paralleltypes) && jt->GetStatus() != Element::Ghost)) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask)))
{
Storage::integer_array indarr = jt->IntegerArray(it->indices);
for (Storage::integer_array::iterator qt = indarr.begin(); qt != indarr.end(); ++qt)
......@@ -742,8 +742,8 @@ namespace INMOST
}
else
{
for (Mesh::base_iterator jt = m->Begin(etype); jt != m->End(); ++jt)
if (((etype & paralleltypes) && static_cast<Element *>(&*jt)->GetStatus() != Element::Ghost) && (jt->HaveData(it->d.t) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask))))
for (Mesh::iteratorElement jt = m->BeginElement(etype); jt != m->EndElement(); ++jt)
if ((!(etype & paralleltypes) || ((etype & paralleltypes) && jt->GetStatus() != Element::Ghost)) && (jt->HaveData(it->d.t) && (it->d.domain_mask == 0 || jt->GetMarker(it->d.domain_mask))))
{
Storage::integer_array indarr = jt->IntegerArray(it->indices);
for (Storage::integer_array::iterator qt = indarr.begin(); qt != indarr.end(); ++qt)
......@@ -758,7 +758,7 @@ namespace INMOST
{
std::vector<Tag> exch_tags;
for (index_enum::iterator it = index_tags.begin(); it != index_tags.end(); ++it) exch_tags.push_back(it->indices);
m->ExchangeData(exch_tags, exch_mask);
m->ExchangeData(exch_tags, exch_mask,0);
}
}
#endif
......@@ -768,24 +768,25 @@ namespace INMOST
/// don't register tag twice
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStaticTag(Tag t, MarkerType domain_mask)
{
INMOST_DATA_ENUM_TYPE ret = reg_ctags.size() + AD_CTAG;
INMOST_DATA_ENUM_TYPE ret = static_cast<INMOST_DATA_ENUM_TYPE>(reg_ctags.size()) + AD_CTAG;
tagdomain d;
d.t = t;
d.domain_mask = domain_mask;
reg_ctags[ret] = d;
reg_ctags.push_back(d);
return ret;
}
INMOST_DATA_ENUM_TYPE Automatizator::GetStencil(INMOST_DATA_ENUM_TYPE stnclind, Storage * elem, void * user_data, stencil_pairs & ret)
INMOST_DATA_ENUM_TYPE Automatizator::GetStencil(INMOST_DATA_ENUM_TYPE stnclind, const Storage & elem, void * user_data, stencil_pairs & ret)
{
stencil_kind_domain & st = reg_stencils[stnclind];
stencil_kind_domain & st = reg_stencils[stnclind-AD_STNCL];
assert(st.domainmask == 0 || elem->GetMarker(st.domainmask));
if (st.kind == 0)
{
Storage::reference_array elems = elem->ReferenceArray(static_cast<stencil_tag *>(st.link)->elements);
Storage::real_array coefs = elem->RealArray(static_cast<stencil_tag *>(st.link)->coefs);
assert(elems.size() == coefs.size());
for (INMOST_DATA_ENUM_TYPE k = 0; k < elems.size(); ++k) ret.push_back(std::make_pair(elems[k], coefs[k]));
for (INMOST_DATA_ENUM_TYPE k = 0; k < elems.size(); ++k)
ret.push_back(std::make_pair(elems.at(k), coefs[k]));
}
else if (st.kind == 1) reinterpret_cast<stencil_callback>(st.link)(elem, ret, user_data);
return static_cast<INMOST_DATA_ENUM_TYPE>(ret.size());
......
......@@ -4,186 +4,172 @@
namespace INMOST
{
Cell::Cell(Mesh * m)
:Element(m,CELL)
{
}
Cell::Cell(Mesh * m, INMOST_DATA_ENUM_TYPE lid, const Cell & other)
:Element(m,lid,other)
{
}
Cell::Cell(const Cell & other)
:Element(other)
{
}
Cell & Cell::operator =(Cell const & other)
{
Element::operator =(other);
return *this;
}
Cell::~Cell()
{
}
bool Cell::CheckEdgeOrder()
bool Cell::CheckEdgeOrder() const
{
assert(GetHandleElementType(GetHandle())==CELL);
return true;
}
bool Cell::FixEdgeOrder()
bool Cell::FixEdgeOrder() const
{
assert(GetHandleElementType(GetHandle())==CELL);
return false;
}
adjacent<Node> Cell::getNodes()
ElementArray<Node> Cell::getNodes() const
{
if( !GetMeshLink()->HideMarker() )
assert(GetHandleElementType(GetHandle())==CELL);
Mesh * m = GetMeshLink();
if( !m->HideMarker() )
{
adj_type & hc = HighConn();
return adjacent<Node>(hc.data(),hc.data()+hc.size());
adj_type const & hc = m->HighConn(GetHandle());
return ElementArray<Node>(m,hc.data(),hc.data()+hc.size());
}
else
{
MarkerType hm = GetMeshLink()->HideMarker();
adjacent<Node> aret;
adj_type & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); ++it)
if( !hc[it]->GetMarker(hm) ) aret.push_back(hc[it]);
MarkerType hm = m->HideMarker();
ElementArray<Node> aret(m);