Commit b73dc746 authored by Kirill Terekhov's avatar Kirill Terekhov
Browse files

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)
{
......
This diff is collapsed.
......@@ -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);
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( !m->GetMarker(hc[it],hm) ) aret.push_back(hc[it]);
return aret;
}
}
adjacent<Node> Cell::getNodes(MarkerType mask, bool invert)
ElementArray<Node> Cell::getNodes(MarkerType mask, bool invert) const
{
adjacent<Node> aret;
if( !GetMeshLink()->HideMarker() )
assert(GetHandleElementType(GetHandle())==CELL);
Mesh * m = GetMeshLink();
ElementArray<Node> aret(m);
if( !m->HideMarker() )
{
adj_type & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); ++it)
if( invert ^ hc[it]->GetMarker(mask) ) aret.push_back(hc[it]);
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( invert ^ m->GetMarker(hc[it],mask) )
aret.push_back(hc[it]);
}
else
{
MarkerType hm = GetMeshLink()->HideMarker();
adj_type & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); ++it)
if( (invert ^ hc[it]->GetMarker(mask)) && !hc[it]->GetMarker(hm) ) aret.push_back(hc[it]);
MarkerType hm = m->HideMarker();
adj_type const & hc = m->HighConn(GetHandle());
for(adj_type::size_type it = 0; it < hc.size(); ++it)
if( (invert ^ m->GetMarker(hc[it],mask)) && !m->GetMarker(hc[it],hm) )
aret.push_back(hc[it]);
}
return aret;
}
adjacent<Edge> Cell::getEdges()
ElementArray<Edge> Cell::getEdges() const
{
adjacent<Edge> aret;
if( !GetMeshLink()->HideMarker() )
assert(GetHandleElementType(GetHandle())==CELL);
Mesh * m = GetMeshLink();
ElementArray<Edge> aret(m);
if( !m->HideMarker() )
{
if( GetElementDimension() == 2 ) // This cell is 2d face
if( Element::GetGeometricDimension(m->GetGeometricType(GetHandle())) == 2 ) // This cell is 2d face
{
adj_type & lc = LowConn();
adj_type const & lc = m->LowConn(GetHandle());
aret.reserve(lc.size());
Element * q = lc[0]; //edge 0
adj_type & qlc = q->LowConn();
HandleType q = lc[0]; //edge 0
adj_type const & qlc = m->LowConn(q);
aret.push_back(qlc[0]); //node 0
aret.push_back(qlc[1]); //node 1
Element * r = lc[1]; //edge 1
adj_type & rlc = r->LowConn();
HandleType r = lc[1]; //edge 1
adj_type const & rlc = m->LowConn(r);
if( aret.data()[0] == rlc[0] || aret.data()[0] == rlc[1] )
{
Edge * temp = aret.data()[0];
HandleType temp = aret.data()[0];
aret.data()[0] = aret.data()[1];
aret.data()[1] = temp;
}
adj_type::enumerator it = 1, iend = lc.size()-1;
adj_type::size_type it = 1, iend = lc.size()-1;
while(it < iend) //loop over edges
{
adj_type & ilc = lc[it]->LowConn();
if( &aret.back() == ilc[0] ) aret.push_back(ilc[1]);
else aret.push_back(ilc[0]);
adj_type const & ilc = m->LowConn(lc[it]);
if( aret.atback() == ilc[0] )
aret.push_back(ilc[1]);
else
aret.push_back(ilc[0]);
++it;
}
}
else
{
Mesh * m = GetMeshLink();
MarkerType mrk = m->CreateMarker();
adj_type & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); it++) //faces
adj_type const & lc = m->LowConn(GetHandle());
for(adj_type::size_type it = 0; it < lc.size(); it++) //faces
{
adj_type & ilc = lc[it]->LowConn();
for(adj_type::enumerator jt = 0; jt < ilc.size(); jt++) //edges
if( !ilc[jt]->GetMarker(mrk))
adj_type const & ilc = m->LowConn(lc[it]);
for(adj_type::size_type jt = 0; jt < ilc.size(); jt++) //edges
if( !m->GetMarker(ilc[jt],mrk))
{
aret.push_back(ilc[jt]);
ilc[jt]->SetMarker(mrk);
m->SetMarker(ilc[jt],mrk);
}
}
for(adjacent<Edge>::enumerator it = 0; it < aret.size(); it++)
aret[it].RemMarker(mrk);
for(ElementArray<Edge>::size_type it = 0; it < aret.size(); it++)
m->RemMarker(aret.at(it),mrk);
m->ReleaseMarker(mrk);
}
}
else
{
MarkerType hm = GetMeshLink()->HideMarker();
if( GetElementDimension() == 2 ) // This cell is 2d face
MarkerType hm = m->HideMarker();
if( Element::GetGeometricDimension(m->GetGeometricType(GetHandle())) == 2 ) // This cell is 2d face
{
INMOST_DATA_ENUM_TYPE i = static_cast<INMOST_DATA_ENUM_TYPE>(-1),
k = static_cast<INMOST_DATA_ENUM_TYPE>(-1),
k1 = static_cast<INMOST_DATA_ENUM_TYPE>(-1), k2;
adj_type & lc = LowConn();
integer i = -1, k = -1, k1 = -1, k2;
adj_type const & lc = m->LowConn(GetHandle());
aret.reserve(lc.size());
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
Element * q = lc[i]; //edge 0
adj_type & qlc = q->LowConn();
k = Mesh::getNext(qlc.data(),qlc.size(),k,hm);
i = m->getNext(lc.data(),static_cast<integer>(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);
aret.push_back(qlc[k]); //node 0
k = Mesh::getNext(qlc.data(),qlc.size(),k,hm);
k = m->getNext(qlc.data(),static_cast<integer>(qlc.size()),k,hm);
aret.push_back(qlc[k]); //node 1
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
Element * r = lc[i]; //edge 1
adj_type & rlc = r->LowConn();
k1 = Mesh::getNext(rlc.data(),rlc.size(),k1,hm);
k2 = Mesh::getNext(rlc.data(),rlc.size(),k1,hm);
i = m->getNext(lc.data(),static_cast<integer>(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);
if( aret.data()[0] == rlc[k1] || aret.data()[0] == rlc[k2] )
{
Edge * temp = aret.data()[0];
HandleType temp = aret.data()[0];
aret.data()[0] = aret.data()[1];
aret.data()[1] = temp;
}
adj_type::enumerator it = 1, iend = lc.size()-1;
while(it < iend) if( !lc[it]->GetMarker(hm) ) //loop over edges
adj_type::size_type it = 1, iend = lc.size()-1;
while(it < iend) if( !m->GetMarker(lc[it],hm) ) //loop over edges
{
adj_type & ilc = lc[it]->LowConn();
k1 = static_cast<INMOST_DATA_ENUM_TYPE>(-1);
k1 = Mesh::getNext(ilc.data(),ilc.size(),k1,hm);
k2 = Mesh::getNext(ilc.data(),ilc.size(),k1,hm);
if( &aret.back() == ilc[k1] ) aret.push_back(ilc[k2]);
else aret.push_back(ilc[k1]);
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);
if( aret.atback() == ilc[k1] )
aret.push_back(ilc[k2]);
else
aret.push_back(ilc[k1]);
++it;
}
}
else
{
Mesh * m = GetMeshLink();
MarkerType mrk = m->CreateMarker();
adj_type & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); it++) if( !lc[it]->GetMarker(hm) ) //faces
adj_type const & lc = m->LowConn(GetHandle());
for(adj_type::size_type it = 0; it < lc.size(); it++) if( !m->GetMarker(lc[it],hm) ) //faces
{
adj_type & ilc = lc[it]->LowConn();
for(adj_type::enumerator jt = 0; jt < ilc.size(); jt++) if( !ilc[jt]->GetMarker(hm) )//edges
if( !ilc[jt]->GetMarker(mrk))
adj_type const & ilc = m->LowConn(lc[it]);
for(adj_type::size_type jt = 0; jt < ilc.size(); jt++) if( !m->GetMarker(ilc[jt],hm) )//edges
if( !m->GetMarker(ilc[jt],mrk))
{
aret.push_back(ilc[jt]);
ilc[jt]->SetMarker(mrk);
m->SetMarker(ilc[jt],mrk);
}
}
for(adjacent<Edge>::enumerator it = 0; it < aret.size(); it++)
aret[it].RemMarker(mrk);
for(ElementArray<Edge>::size_type it = 0; it < aret.size(); it++)
m->RemMarker(aret.at(it),mrk);
m->ReleaseMarker(mrk);
}
}
......@@ -191,175 +177,176 @@ namespace INMOST
}
adjacent<Edge> Cell::getEdges(MarkerType mask, bool invert)
ElementArray<Edge> Cell::getEdges(MarkerType mask, bool invert) const
{
adjacent<Edge> aret;
if( !GetMeshLink()->HideMarker() )
assert(GetHandleElementType(GetHandle())==CELL);
Mesh * m = GetMeshLink();
ElementArray<Edge> aret(m);
if( !m->HideMarker() )
{
if( GetElementDimension() == 2 ) // This cell is 2d face
if( Element::GetGeometricDimension(m->GetGeometricType(GetHandle())) == 2 ) // This cell is 2d face
{
adj_type & lc = LowConn();
adj_type const & lc = m->LowConn(GetHandle());
aret.reserve(lc.size());
Element * last, * first;
Element * q = lc[0]; //edge 0
adj_type & qlc = q->LowConn();
if( invert ^ qlc[0]->GetMarker(mask) ) aret.push_back(qlc[0]); //node 0
if( invert ^ qlc[1]->GetMarker(mask) ) aret.push_back(qlc[1]); //node 1
HandleType last, first;
HandleType q = lc[0]; //edge 0
adj_type const & qlc = m->LowConn(q);
if( invert ^ m->GetMarker(qlc[0],mask) ) aret.push_back(qlc[0]); //node 0
if( invert ^ m->GetMarker(qlc[1],mask) ) aret.push_back(qlc[1]); //node 1
first = qlc[0];
last = qlc[1];
Element * r = lc[1]; //edge 1
adj_type & rlc = r->LowConn();
HandleType r = lc[1]; //edge 1
adj_type const & rlc = m->LowConn(r);
if( first == rlc[0] || first == rlc[1] )
{
last = first;
if( aret.size() > 1 )
{
Edge * temp = aret.data()[0];
HandleType temp = aret.data()[0];
aret.data()[0] = aret.data()[1];
aret.data()[1] = temp;
}
}
adj_type::enumerator it = 1, iend = lc.size()-1;
adj_type::size_type it = 1, iend = lc.size()-1;
while(it < iend) //loop over edges
{
adj_type & ilc = lc[it]->LowConn();
adj_type const & ilc = m->LowConn(lc[it]);
if( last == ilc[0] ) last = ilc[1];
else last = ilc[0];
if( invert ^ last->GetMarker(mask) ) aret.push_back(last);
if( invert ^ m->GetMarker(last,mask) )
aret.push_back(last);
++it;
}
}
else
{
Mesh * m = GetMeshLink();
MarkerType mrk = m->CreateMarker();
adj_type & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); it++) //faces
adj_type const & lc = m->LowConn(GetHandle());
for(adj_type::size_type it = 0; it < lc.size(); it++) //faces
{
adj_type & ilc = lc[it]->LowConn();
for(adj_type::enumerator jt = 0; jt != ilc.size(); jt++) //edges
if( (invert ^ ilc[jt]->GetMarker(mask)) && !ilc[jt]->GetMarker(mrk))
adj_type const & ilc = m->LowConn(lc[it]);
for(adj_type::size_type jt = 0; jt != ilc.size(); jt++) //edges
if( (invert ^ m->GetMarker(ilc[jt],mask)) && !m->GetMarker(ilc[jt],mrk))
{
aret.push_back(ilc[jt]);
ilc[jt]->SetMarker(mrk);
m->SetMarker(ilc[jt],mrk);
}
}
for(adjacent<Edge>::enumerator it = 0; it != aret.size(); it++)
aret[it].RemMarker(mrk);
for(ElementArray<Edge>::size_type it = 0; it != aret.size(); it++)
m->RemMarker(aret.at(it),mrk);
m->ReleaseMarker(mrk);
}
}
else
{
MarkerType hm = GetMeshLink()->HideMarker();
if( GetElementDimension() == 2 ) // This cell is 2d face
if( Element::GetGeometricDimension(m->GetGeometricType(GetHandle())) == 2 ) // This cell is 2d face
{
INMOST_DATA_ENUM_TYPE i = static_cast<INMOST_DATA_ENUM_TYPE>(-1),
k = static_cast<INMOST_DATA_ENUM_TYPE>(-1),
k1 = static_cast<INMOST_DATA_ENUM_TYPE>(-1), k2;
Element * last, * first;
adj_type & lc = LowConn();
integer i = -1, k = -1, k1 = -1, k2;
HandleType last, first;
adj_type const & lc = m->LowConn(GetHandle());
aret.reserve(lc.size());
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
Element * q = lc[i]; //edge 0
adj_type & qlc = q->LowConn();
k = Mesh::getNext(qlc.data(),qlc.size(),k,hm);
if( invert ^ qlc[k]->GetMarker(mask) ) aret.push_back(qlc[k]); //node 0
i = m->getNext(lc.data(),static_cast<integer>(lc.size()),i,hm);