Commit 97ea10c7 authored by Kirill Terekhov's avatar Kirill Terekhov

some updates

Moving connections, markers, geometric type, sparse data from Storage
class to TagManager class by using standard handling of mesh data.
parent 0a715fdf
......@@ -221,7 +221,7 @@ namespace INMOST
lval = (e->GetElementType() & reinterpret_cast<ElementType>(var.left))? 1.0 : -1.0;
return lval;
case AD_COND_MARK:
lval = e->GetMarker(reinterpret_cast<MIDType>(var.left))? 1.0 : -1.0;
lval = e->GetMarker(reinterpret_cast<MarkerType>(var.left))? 1.0 : -1.0;
return lval;
case AD_COND:
lval = Evaluate(*var.left, e, user_data);
......@@ -477,7 +477,7 @@ namespace INMOST
assert(var.op != AD_NONE);
switch (var.op)
{
case AD_COND_MARK: return e->GetMarker(reinterpret_cast<MIDType>(var.left)) ? 1.0 : -1.0;
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: 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;
......@@ -560,7 +560,7 @@ namespace INMOST
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, MIDType domain_mask)
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;
stencil_kind_domain st;
......@@ -575,7 +575,7 @@ namespace INMOST
return ret;
}
//register stencil that can be got from function
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStencil(std::string name, stencil_callback func, MIDType domain_mask)
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;
stencil_kind_domain st;
......@@ -601,7 +601,7 @@ namespace INMOST
}
/// set data of tag t defined on domain_mask to be dynamic data
/// don't register tag twice
INMOST_DATA_ENUM_TYPE Automatizator::RegisterDynamicTag(Tag t, ElementType typemask, MIDType domain_mask)
INMOST_DATA_ENUM_TYPE Automatizator::RegisterDynamicTag(Tag t, ElementType typemask, MarkerType domain_mask)
{
tagpair p;
p.d.domain_mask = domain_mask;
......@@ -766,7 +766,7 @@ namespace INMOST
}
/// register tag, data for which don't change through iterations
/// don't register tag twice
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStaticTag(Tag t, MIDType domain_mask)
INMOST_DATA_ENUM_TYPE Automatizator::RegisterStaticTag(Tag t, MarkerType domain_mask)
{
INMOST_DATA_ENUM_TYPE ret = reg_ctags.size() + AD_CTAG;
tagdomain d;
......
This diff is collapsed.
This diff is collapsed.
......@@ -32,18 +32,20 @@ namespace INMOST
{
if( !GetMeshLink()->HideMarker() )
{
if( low_conn.empty() )
adj_type const & lc = LowConn();
if( lc.empty() )
return NULL;
return low_conn.front()->getAsNode();
return lc.front()->getAsNode();
}
else
{
if( !low_conn.empty() )
adj_type const & lc = LowConn();
if( !lc.empty() )
{
INMOST_DATA_ENUM_TYPE i = static_cast<INMOST_DATA_ENUM_TYPE>(-1);
MIDType hm = GetMeshLink()->HideMarker();
i = Mesh::getNext(&low_conn[0],low_conn.size(),i,hm);
if( i != low_conn.size() ) return low_conn[i]->getAsNode();
MarkerType hm = GetMeshLink()->HideMarker();
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
if( i != lc.size() ) return lc[i]->getAsNode();
}
return NULL;
}
......@@ -52,19 +54,21 @@ namespace INMOST
{
if( !GetMeshLink()->HideMarker() )
{
if( low_conn.size() < 2 )
adj_type const & lc = LowConn();
if( lc.size() < 2 )
return NULL;
return low_conn.back()->getAsNode();
return lc.back()->getAsNode();
}
else
{
if( !low_conn.empty() )
adj_type const & lc = LowConn();
if( !lc.empty() )
{
INMOST_DATA_ENUM_TYPE i = static_cast<INMOST_DATA_ENUM_TYPE>(-1);
MIDType hm = GetMeshLink()->HideMarker();
i = Mesh::getNext(&low_conn[0],low_conn.size(),i,hm);
i = Mesh::getNext(&low_conn[0],low_conn.size(),i,hm);
if( i != low_conn.size() ) return low_conn[i]->getAsNode();
MarkerType hm = GetMeshLink()->HideMarker();
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
i = Mesh::getNext(lc.data(),lc.size(),i,hm);
if( i != lc.size() ) return lc[i]->getAsNode();
}
return NULL;
}
......@@ -73,30 +77,36 @@ namespace INMOST
adjacent<Node> Edge::getNodes()
{
if( !GetMeshLink()->HideMarker() )
return adjacent<Node>(low_conn.begin(),low_conn.end());
{
adj_type & lc = LowConn();
return adjacent<Node>(lc.data(),lc.data()+lc.size());
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
MarkerType hm = GetMeshLink()->HideMarker();
adjacent<Node> aret;
for(adj_iterator it = low_conn.begin(); it != low_conn.end(); ++it)
if( !(*it)->GetMarker(hm) ) aret.push_back((*it));
adj_type const & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); ++it)
if( !lc[it]->GetMarker(hm) ) aret.push_back(lc[it]);
return aret;
}
}
adjacent<Node> Edge::getNodes(MIDType mask, bool invert)
adjacent<Node> Edge::getNodes(MarkerType mask, bool invert)
{
adjacent<Node> aret;
if( !GetMeshLink()->HideMarker() )
{
for(adj_iterator it = low_conn.begin(); it != low_conn.end(); ++it)
if( invert ^ (*it)->GetMarker(mask) ) aret.push_back((*it));
adj_type const & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); ++it)
if( invert ^ lc[it]->GetMarker(mask) ) aret.push_back(lc[it]);
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
for(adj_iterator it = low_conn.begin(); it != low_conn.end(); ++it)
if( (invert ^ (*it)->GetMarker(mask)) && !(*it)->GetMarker(hm) ) aret.push_back((*it));
MarkerType hm = GetMeshLink()->HideMarker();
adj_type const & lc = LowConn();
for(adj_type::enumerator it = 0; it < lc.size(); ++it)
if( (invert ^ lc[it]->GetMarker(mask)) && !lc[it]->GetMarker(hm) ) aret.push_back(lc[it]);
}
return aret;
}
......@@ -104,31 +114,37 @@ namespace INMOST
adjacent<Face> Edge::getFaces()
{
if( !GetMeshLink()->HideMarker() )
return adjacent<Face>(high_conn.begin(),high_conn.end());
{
adj_type const & hc = HighConn();
return adjacent<Face>(hc.data(),hc.data()+hc.size());
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
MarkerType hm = GetMeshLink()->HideMarker();
adjacent<Face> aret;
for(adj_iterator it = high_conn.begin(); it != high_conn.end(); ++it)
if( !(*it)->GetMarker(hm) ) aret.push_back((*it));
adj_type const & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); ++it)
if( !hc[it]->GetMarker(hm) ) aret.push_back(hc[it]);
return aret;
}
}
adjacent<Face> Edge::getFaces(MIDType mask, bool invert)
adjacent<Face> Edge::getFaces(MarkerType mask, bool invert)
{
adjacent<Face> aret;
if( !GetMeshLink()->HideMarker() )
{
for(adj_iterator it = high_conn.begin(); it != high_conn.end(); ++it)
if( (invert ^ (*it)->GetMarker(mask)) ) aret.push_back((*it));
adj_type const & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); ++it)
if( (invert ^ hc[it]->GetMarker(mask)) ) aret.push_back(hc[it]);
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
for(adj_iterator it = high_conn.begin(); it != high_conn.end(); ++it)
if( (invert ^ (*it)->GetMarker(mask)) && !(*it)->GetMarker(hm) ) aret.push_back((*it));
MarkerType hm = GetMeshLink()->HideMarker();
adj_type const & 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]);
}
return aret;
}
......@@ -137,62 +153,76 @@ namespace INMOST
{
adjacent<Cell> aret;
Mesh * m = GetMeshLink();
MIDType mrk = m->CreateMarker();
MarkerType mrk = m->CreateMarker();
if( !GetMeshLink()->HideMarker() )
{
for(Element::adj_iterator it = high_conn.begin(); it != high_conn.end(); it++) //faces
for(Element::adj_iterator jt = (*it)->high_conn.begin(); jt != (*it)->high_conn.end(); jt++) //cels
if( !(*jt)->GetMarker(mrk) )
adj_type const & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); it++) //faces
{
adj_type const & ihc = hc[it]->HighConn();
for(adj_type::enumerator jt = 0; jt < ihc.size(); jt++) //cels
if( !ihc[jt]->GetMarker(mrk) )
{
aret.push_back(*jt);
(*jt)->SetMarker(mrk);
aret.push_back(ihc[jt]);
ihc[jt]->SetMarker(mrk);
}
}
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
for(Element::adj_iterator it = high_conn.begin(); it != high_conn.end(); it++) if( !(*it)->GetMarker(hm) ) //faces
for(Element::adj_iterator jt = (*it)->high_conn.begin(); jt != (*it)->high_conn.end(); jt++) if( !(*jt)->GetMarker(hm) ) //cels
if( !(*jt)->GetMarker(mrk) )
MarkerType hm = GetMeshLink()->HideMarker();
adj_type const & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); it++) if( !hc[it]->GetMarker(hm) ) //faces
{
adj_type const & ihc = hc[it]->HighConn();
for(adj_type::enumerator jt = 0; jt < ihc.size(); jt++) if( !ihc[jt]->GetMarker(hm) ) //cels
if( !ihc[jt]->GetMarker(mrk) )
{
aret.push_back(*jt);
(*jt)->SetMarker(mrk);
aret.push_back(ihc[jt]);
ihc[jt]->SetMarker(mrk);
}
}
}
for(adjacent<Cell>::iterator it = aret.begin(); it != aret.end(); it++)
it->RemMarker(mrk);
for(adjacent<Cell>::enumerator it = 0; it < aret.size(); it++) aret[it].RemMarker(mrk);
m->ReleaseMarker(mrk);
return aret;
}
adjacent<Cell> Edge::getCells(MIDType mask, bool invert)
adjacent<Cell> Edge::getCells(MarkerType mask, bool invert)
{
adjacent<Cell> aret;
Mesh * m = GetMeshLink();
MIDType mrk = m->CreateMarker();
MarkerType mrk = m->CreateMarker();
if( !GetMeshLink()->HideMarker() )
{
for(Element::adj_iterator it = high_conn.begin(); it != high_conn.end(); it++) //faces
for(Element::adj_iterator jt = (*it)->high_conn.begin(); jt != (*it)->high_conn.end(); jt++) //cels
if( (invert ^ (*jt)->GetMarker(mask)) && !(*jt)->GetMarker(mrk) )
adj_type const & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); it++) //faces
{
adj_type const & ihc = hc[it]->HighConn();
for(adj_type::enumerator jt = 0; jt < ihc.size(); jt++) //cels
if( (invert ^ ihc[jt]->GetMarker(mask)) && !ihc[jt]->GetMarker(mrk) )
{
aret.push_back(*jt);
(*jt)->SetMarker(mrk);
aret.push_back(ihc[jt]);
ihc[jt]->SetMarker(mrk);
}
}
}
else
{
MIDType hm = GetMeshLink()->HideMarker();
for(Element::adj_iterator it = high_conn.begin(); it != high_conn.end(); it++) if( !(*it)->GetMarker(hm) ) //faces
for(Element::adj_iterator jt = (*it)->high_conn.begin(); jt != (*it)->high_conn.end(); jt++) if( !(*jt)->GetMarker(hm) ) //cels
if( (invert ^ (*jt)->GetMarker(mask)) && !(*jt)->GetMarker(mrk) )
MarkerType hm = GetMeshLink()->HideMarker();
adj_type const & hc = HighConn();
for(adj_type::enumerator it = 0; it < hc.size(); it++) if( !hc[it]->GetMarker(hm) ) //faces
{
adj_type const & ihc = hc[it]->HighConn();
for(adj_type::enumerator jt = 0; jt < ihc.size(); jt++) if( !ihc[jt]->GetMarker(hm) ) //cels
if( (invert ^ ihc[jt]->GetMarker(mask)) && !ihc[jt]->GetMarker(mrk) )
{
aret.push_back(*jt);
(*jt)->SetMarker(mrk);
aret.push_back(ihc[jt]);
ihc[jt]->SetMarker(mrk);
}
}
}
for(adjacent<Cell>::iterator it = aret.begin(); it != aret.end(); it++)
it->RemMarker(mrk);
for(adjacent<Cell>::enumerator it = 0; it < aret.size(); it++) aret[it].RemMarker(mrk);
m->ReleaseMarker(mrk);
return aret;
}
......
This diff is collapsed.
......@@ -155,7 +155,7 @@ namespace INMOST
}
size_t ElementSet::size() const
INMOST_DATA_ENUM_TYPE ElementSet::size() const
{
return eset.size();
}
......@@ -179,12 +179,12 @@ namespace INMOST
}
void ElementSet::SetElementsMarker(MIDType marker)
void ElementSet::SetElementsMarker(MarkerType marker)
{
for(ElementSet::iterator it = begin(); it != end(); it++)
it->SetMarker(marker);
}
void ElementSet::RemElementsMarker(MIDType marker)
void ElementSet::RemElementsMarker(MarkerType marker)
{
for(ElementSet::iterator it = begin(); it != end(); it++)
it->RemMarker(marker);
......
......@@ -319,7 +319,7 @@ void cellGetFaceVerts(struct grid * g, int m, int side, int * nverts, Node * ver
std::vector<Edge *> traverse_edges_sub(Edge * start, Edge * current, MIDType edgeset, MIDType visited_bridge, MIDType visited_edge)
std::vector<Edge *> traverse_edges_sub(Edge * start, Edge * current, MarkerType edgeset, MarkerType visited_bridge, MarkerType visited_edge)
{
//~ if( current == start ) return std::vector<Edge *> (1,start);
std::vector< std::vector<Edge *> > paths;
......@@ -366,7 +366,7 @@ std::vector<Edge *> traverse_edges_sub(Edge * start, Edge * current, MIDType edg
}
//This function may be slow, because we collect all the arrays
//should detect shortest path here, then collect one array with shortest path
std::vector<Edge *> traverse_edges(Edge * start, MIDType edgeset, MIDType visited_bridge, MIDType visited_edge)
std::vector<Edge *> traverse_edges(Edge * start, MarkerType edgeset, MarkerType visited_bridge, MarkerType visited_edge)
{
std::vector< std::vector<Edge *> > paths;
adjacent<Node> n = start->getNodes();
......@@ -757,7 +757,7 @@ public:
if( !head_column.empty() )
{
Mesh * m = head_column[0]->GetMeshLink();
MIDType hide_marker = m->CreateMarker();
MarkerType hide_marker = m->CreateMarker();
visits.resize(head_column.size());
for(typename dynarray<T, 256>::iterator it = head_column.begin(); it != head_column.end(); ++it)
......@@ -857,7 +857,7 @@ public:
if( !ret.empty() )
{
Mesh * m = ret[0]->GetMeshLink();
MIDType hide_marker = m->CreateMarker();
MarkerType hide_marker = m->CreateMarker();
for(unsigned k = 0; k < ret.size(); k++) ret[k]->SetMarker(hide_marker);
for(unsigned k = 0; k < head_column.size(); k++)
if( head_column[k]->GetMarker(hide_marker) ) visits[k]--;
......@@ -875,9 +875,9 @@ public:
class edge_Comparator
{
private: MIDType medge;
private: MarkerType medge;
public:
edge_Comparator(MIDType medge):medge(medge){}
edge_Comparator(MarkerType medge):medge(medge){}
bool operator()(Edge * a, Edge * b){return a->GetMarker(medge) < b->GetMarker(medge);}
};
......@@ -1046,10 +1046,10 @@ void cellCreateINMOST(struct grid * g, int m, bool print = false)
else
{
MIDType face_on_face = g->mesh->CreateMarker();
MIDType edge_on_face = g->mesh->CreateMarker();
MIDType edge_on_edge = g->mesh->CreateMarker();
MIDType multi_edge = g->mesh->CreateMarker();
MarkerType face_on_face = g->mesh->CreateMarker();
MarkerType edge_on_face = g->mesh->CreateMarker();
MarkerType edge_on_edge = g->mesh->CreateMarker();
MarkerType multi_edge = g->mesh->CreateMarker();
dynarray<Element *,16> en1;
tiny_map<int,int, 64> edges_mat;
......@@ -1144,7 +1144,7 @@ void cellCreateINMOST(struct grid * g, int m, bool print = false)
en1.clear();
adjacent<Element> nodesn0 = n0->BridgeAdjacencies(EDGE,NODE);
adjacent<Element> nodesn2 = n2->BridgeAdjacencies(EDGE,NODE);
MIDType inter = g->mesh->CreateMarker();
MarkerType inter = g->mesh->CreateMarker();
if( inter == 0 ) throw -1;
......@@ -1736,7 +1736,7 @@ void cellCreateINMOST(struct grid * g, int m, bool print = false)
{
//mark elements to skip
mat_union.clear();
MIDType skip = g->mesh->CreateMarker();
MarkerType skip = g->mesh->CreateMarker();
for(unsigned jj = 1; jj < face_elements.size()+1; jj++) //start from edge
{
int de = (found+jj)%face_elements.size(); // actual element
......@@ -1999,7 +1999,7 @@ exit_work: if( !success )
if( print ) std::cout << "created face centered node!" << std::endl;
MIDType del = g->mesh->CreateMarker();
MarkerType del = g->mesh->CreateMarker();
for(j = 1; j < face_elements.size(); j+=2) if( !face_elements[j]->GetMarker(edge_on_edge) ) face_elements[j]->SetMarker(del);
dynarray<Edge*,128>::iterator it = face_edges.begin();
......@@ -2438,7 +2438,7 @@ exit_work: if( !success )
mat.insert(mat.end(),mat_union.begin(),mat_union.end());
//now connect central node with cuts on edges
MIDType mrk = g->mesh->CreateMarker();
MarkerType mrk = g->mesh->CreateMarker();
for(j = 0; j < l; j++)
{
//edge_cut_nodes[j].insert(edge_cut_nodes[j].end(),edge_cut_nodes2[j].begin(),edge_cut_nodes2[j].end());// do we need to connect degenerate cuts?
......@@ -2512,7 +2512,7 @@ exit_work: if( !success )
//Node * remember[2] = {edge_nodes[0],edge_nodes[1]};
//MIDType mrk = g->mesh->CreateMarker();
//MarkerType mrk = g->mesh->CreateMarker();
/*
for(j = 0; j < l; j++)
{
......@@ -2594,7 +2594,7 @@ exit_work: if( !success )
mat1 = node_in_face[j]->IntegerArray(g->materials);
break;
}
MIDType mrk = g->mesh->CreateMarker();
MarkerType mrk = g->mesh->CreateMarker();
for(j = 0; j < l; j++)
{
edge_cut_nodes[j].insert(edge_cut_nodes[j].end(),edge_cut_nodes2[j].begin(),edge_cut_nodes2[j].end());// do we need to connect degenerate cuts?
......@@ -2697,7 +2697,7 @@ exit_work: if( !success )
if( print ) std::cout << " connections between edgecuts " << std::endl;
Storage::real c1,c2;
Storage::integer_array mats1,mats2;
MIDType mrk = g->mesh->CreateMarker();
MarkerType mrk = g->mesh->CreateMarker();
for(j = 0; j < l; j++)
{
edge_cut_nodes[j].insert(edge_cut_nodes[j].end(),edge_cut_nodes2[j].begin(),edge_cut_nodes2[j].end());
......@@ -2920,7 +2920,7 @@ exit_work: if( !success )
if( print ) matrix.print_matrix();
MIDType mrk = g->mesh->CreateMarker();
MarkerType mrk = g->mesh->CreateMarker();
int num_loops = 0;
dynarray<Edge *,32> loop;
......@@ -4124,7 +4124,7 @@ void cellUniteSmallElements(struct grid * g, int m)
{
//~ if( !g->cells[m].busy || !g->cells[m].leaf || g->cells[m].mr->empty() ) return;
Storage::real cell_vol = g->cells[m].vol;
MIDType cell_visited = g->mesh->CreateMarker();
MarkerType cell_visited = g->mesh->CreateMarker();
bool restart = false;
do
{
......@@ -4169,8 +4169,8 @@ void cellUniteSmallElements(struct grid * g, int m)
//~ for(std::map<Cell *, Storage::real>::iterator j = around_cell.begin(); j != around_cell.end(); ++j)
//~ std::cout << j->second << std::endl;
MIDType skip_current = g->mesh->CreateMarker();
MIDType visited = g->mesh->CreateMarker();
MarkerType skip_current = g->mesh->CreateMarker();
MarkerType visited = g->mesh->CreateMarker();
while(unite_vol/cell_vol < MINVOLFRAC )
{
std::map<Cell *, Storage::real>::iterator k = around_cell.end();
......@@ -4216,7 +4216,7 @@ void cellUniteSmallElements(struct grid * g, int m)
//~ std::cout << unite[j] << " " << Element::GeometricTypeName(unite[j]->GetGeometricType()) << " ";
//~ std::cout << std::endl;
//remove them from array we look at
MIDType rem = g->mesh->CreateMarker();
MarkerType rem = g->mesh->CreateMarker();
for(int j = 0; j < unite.size(); j++) unite[j]->SetMarker(rem);
for(int j = 0; j < g->cells[m].mr->size(); j++)
if( (*g->cells[m].mr)[j]->GetMarker(rem) )
......@@ -4279,7 +4279,7 @@ void cellUniteSmallElements(struct grid * g, int m)
{
//~ if( it->first == NULL ) //boundary faces, compare normals
{
MIDType fv = g->mesh->CreateMarker();
MarkerType fv = g->mesh->CreateMarker();
bool found = false;
do
......@@ -4321,7 +4321,7 @@ void cellUniteSmallElements(struct grid * g, int m)
if( unite.size() > 1 )
{
Storage::real unite_area = 0;
MIDType rem = g->mesh->CreateMarker();
MarkerType rem = g->mesh->CreateMarker();
for(unsigned i = 0; i < unite.size(); i++)
{
unite_area += unite[i]->Area();
......
......@@ -73,7 +73,7 @@ struct vert
struct grid
{
Mesh * mesh;
MIDType octree_node;
MarkerType octree_node;
Tag materials, cell_material, parent, united, problem,edge_face_number, face_center_node, Kvec, K;
......
This diff is collapsed.
This diff is collapsed.
......@@ -168,7 +168,7 @@ namespace INMOST
{
for(i = 0; i < num; i++)
{
for(Element::adj_iterator jt = elements[i]->low_conn.begin(); jt!= elements[i]->low_conn.end() ; jt++)
for(Element::adj_iterator jt = elements[i]->LowConn().begin(); jt!= elements[i]->LowConn().end() ; jt++)
find_and_add(e_visit,*jt);
}
}
......@@ -176,7 +176,7 @@ namespace INMOST
{
for(i = 0; i < num; i++) if( !elements[i]->GetMarker(HideMarker()) )
{
for(Element::adj_iterator jt = elements[i]->low_conn.begin(); jt!= elements[i]->low_conn.end() ; jt++) if( !(*jt)->GetMarker(HideMarker()) )
for(Element::adj_iterator jt = elements[i]->LowConn().begin(); jt!= elements[i]->LowConn().end() ; jt++) if( !(*jt)->GetMarker(HideMarker()) )
find_and_add(e_visit,*jt);
}
}
......@@ -265,10 +265,10 @@ namespace INMOST
void Element::ComputeGeometricType()
{
m_type = Unset;
SetGeometricType(Unset);
adjacent<Element> lc = getAdjElements(GetElementType() >> 1);
if( !lc.empty() )
m_type = GetMeshLink()->ComputeGeometricType(GetElementType(),lc.data(),lc.size());
SetGeometricType(GetMeshLink()->ComputeGeometricType(GetElementType(),lc.data(),lc.size()));
/*
if( lc.size() == 0 && etypenum != 0) return;
switch(etypenum)
......@@ -365,8 +365,8 @@ namespace INMOST
if( e->GetElementType() == CELL && HaveGeometricData(ORIENTATION,FACE)) //then correct the normal
{
for(Element::adj_iterator it = e->low_conn.begin(); it != e->low_conn.end(); ++it)
if( !(*it)->GetMarker(HideMarker()) && (*it)->high_conn.size() == 1 )
for(Element::adj_iterator it = e->LowConn().begin(); it != e->LowConn().end(); ++it)
if( !(*it)->GetMarker(HideMarker()) && (*it)->HighConn().size() == 1 )
{
(*it)->getAsFace()->FixNormalOrientation();
}
......@@ -899,12 +899,12 @@ namespace INMOST
bool Cell::Closure()
{
return low_conn.size() > 0 ? GetMeshLink()->TestClosure(&low_conn[0],low_conn.size()) : false;
return LowConn().size() > 0 ? GetMeshLink()->TestClosure(LowConn().data(),LowConn().size()) : false;
}
bool Face::Closure()
{
return low_conn.size() > 0 ? GetMeshLink()->TestClosure(&low_conn[0],low_conn.size()) : false;
return LowConn().size() > 0 ? GetMeshLink()->TestClosure(LowConn().data(),LowConn().size()) : false;
}
......
......@@ -91,13 +91,13 @@ namespace INMOST
typedef dynarray<stencil_pair, 64> stencil_pairs;
typedef void(*stencil_callback)(Storage * current_element, stencil_pairs & out_stencil, void * user_data);
private:
typedef struct{ Tag t; MIDType domain_mask; } tagdomain;
typedef struct{ Tag t; MarkerType domain_mask; } tagdomain;
typedef small_hash<INMOST_DATA_ENUM_TYPE, tagdomain, 128> const_tag_type;
typedef struct{ tagdomain d; Tag indices; } tagpair;
typedef small_hash<INMOST_DATA_ENUM_TYPE, tagpair, 128> tagpairs_type;
typedef std::vector<tagpair> index_enum;
typedef struct { Tag elements, coefs; } stencil_tag;
typedef struct { std::string name; INMOST_DATA_ENUM_TYPE kind; MIDType domainmask; void * link; } stencil_kind_domain;
typedef struct { std::string name; INMOST_DATA_ENUM_TYPE kind; MarkerType domainmask; void * link; } stencil_kind_domain;
typedef small_hash<INMOST_DATA_ENUM_TYPE, stencil_kind_domain, 128> stencil_type;
typedef struct func_name_callback_t { std::string name; func_callback func; } func_name_callback;
typedef small_hash<INMOST_DATA_ENUM_TYPE, func_name_callback, 128> func_type;
......@@ -139,22 +139,22 @@ namespace INMOST
__INLINE INMOST_DATA_ENUM_TYPE GetFirstIndex() { return first_num; }
__INLINE INMOST_DATA_ENUM_TYPE GetLastIndex() { return last_num; }
INMOST_DATA_ENUM_TYPE RegisterFunc(std::string name, func_callback func);
INMOST_DATA_ENUM_TYPE RegisterStencil(std::string name, Tag elements_tag, Tag coefs_tag, MIDType domain_mask = 0);
INMOST_DATA_ENUM_TYPE RegisterStencil(std::string name, stencil_callback func, MIDType domain_mask = 0);
INMOST_DATA_ENUM_TYPE RegisterStencil(std::string name, Tag elements_tag, Tag coefs_tag, MarkerType domain_mask = 0);
INMOST_DATA_ENUM_TYPE RegisterStencil(std::string name, stencil_callback func, MarkerType domain_mask = 0);
INMOST_DATA_ENUM_TYPE RegisterTable(std::string name, INMOST_DATA_REAL_TYPE * Arguments, INMOST_DATA_REAL_TYPE * Values, INMOST_DATA_ENUM_TYPE size);
INMOST_DATA_ENUM_TYPE RegisterDynamicTag(Tag t, ElementType typemask, MIDType domain_mask = 0);
INMOST_DATA_ENUM_TYPE RegisterStaticTag(Tag t, MIDType domain_mask = 0);
INMOST_DATA_ENUM_TYPE RegisterDynamicTag(Tag t, ElementType typemask, MarkerType domain_mask = 0);
INMOST_DATA_ENUM_TYPE RegisterStaticTag(Tag t, MarkerType domain_mask = 0);
void EnumerateDynamicTags();
__INLINE Tag GetDynamicValueTag(INMOST_DATA_ENUM_TYPE ind) { return reg_tags[ind].d.t; }
__INLINE Tag GetDynamicIndexTag(INMOST_DATA_ENUM_TYPE ind) { return reg_tags[ind].indices; }
__INLINE MIDType GetDynamicMask(INMOST_DATA_ENUM_TYPE ind) { return reg_tags[ind].d.domain_mask; }
__INLINE MarkerType GetDynamicMask(INMOST_DATA_ENUM_TYPE ind) { return reg_tags[ind].d.domain_mask; }
__INLINE Tag GetStaticValueTag(INMOST_DATA_ENUM_TYPE ind) { return reg_ctags[ind].t; }
__INLINE MIDType GetStaticMask(INMOST_DATA_ENUM_TYPE ind) { return reg_ctags[ind].domain_mask; }
__INLINE MarkerType GetStaticMask(INMOST_DATA_ENUM_TYPE ind) { return reg_ctags[ind].domain_mask; }
__INLINE INMOST_DATA_REAL_TYPE GetDynamicValue(Storage * e, INMOST_DATA_ENUM_TYPE ind, INMOST_DATA_ENUM_TYPE comp = 0) { return e->RealArray(GetDynamicValueTag(ind))[comp]; }
__INLINE INMOST_DATA_ENUM_TYPE GetDynamicIndex(Storage * e, INMOST_DATA_ENUM_TYPE ind, INMOST_DATA_ENUM_TYPE comp = 0) { return e->IntegerArray(GetDynamicIndexTag(ind))[comp]; }
__INLINE bool isDynamicValid(Storage * e, INMOST_DATA_ENUM_TYPE ind) { MIDType mask = GetDynamicMask(ind); return mask == 0 || e->GetMarker(mask); }
__INLINE bool isDynamicValid(Storage * e, INMOST_DATA_ENUM_TYPE ind) { MarkerType mask = GetDynamicMask(ind); return mask == 0 || e->GetMarker(mask); }
__INLINE INMOST_DATA_REAL_TYPE GetStaticValue(Storage * e, INMOST_DATA_ENUM_TYPE ind, INMOST_DATA_ENUM_TYPE comp = 0) { return e->RealArray(GetStaticValueTag(ind))[comp]; }
__INLINE bool isStaticValid(Storage * e, INMOST_DATA_ENUM_TYPE ind) { MIDType mask = GetStaticMask(ind); return mask == 0 || e->GetMarker(mask); }
__INLINE bool isStaticValid(Storage * e, INMOST_DATA_ENUM_TYPE ind) { MarkerType mask = GetStaticMask(ind); return mask == 0 || e->GetMarker(mask); }
#if defined(NEW_VERSION)
INMOST_DATA_REAL_TYPE Evaluate(expr & var, Storage * e, void * user_data);
INMOST_DATA_REAL_TYPE Derivative(expr & var, Storage * e, Solver::Row & out, Storage::real multiply, void * user_data);
......@@ -607,7 +607,7 @@ namespace INMOST
__INLINE expr measure() { return expr(AD_MES,ENUMUNDEF); }
__INLINE expr condition(const expr & cond, const expr & if_gt, const expr & if_le) { return expr(cond, if_gt, if_le); }
__INLINE expr condition_etype(ElementType etypes, const expr & if_true, const expr & if_false) { return expr(expr(AD_COND_TYPE, etypes), if_true, if_false); }
__INLINE expr condition_marker(MIDType marker, const expr & if_true, const expr & if_false) { return expr(expr(AD_COND_MARK, marker), if_true, if_false); }
__INLINE expr condition_marker(MarkerType marker, const expr & if_true, const expr & if_false) { return expr(expr(AD_COND_MARK, marker), if_true, if_false); }
__INLINE expr stencil(INMOST_DATA_ENUM_TYPE stncl, const expr & v) { assert(stncl >= AD_STNCL && stncl < AD_TABLE); return expr(stncl, &v); }
__INLINE expr tabval(INMOST_DATA_ENUM_TYPE tabl, const expr & v) { assert(tabl >= AD_TABLE && tabl < AD_FUNC); return expr(tabl, v); }
__INLINE expr tagval(INMOST_DATA_ENUM_TYPE reg_tag, INMOST_DATA_ENUM_TYPE comp = 0) { assert(reg_tag >= AD_TAG && reg_tag < AD_STNCL); return expr(reg_tag, comp); }
......@@ -690,7 +690,7 @@ namespace INMOST
__INLINE expr ad_val(const expr & v, const expr & multiplyer = expr(0.0)) {return expr(AD_VAL,new expr(v), new expr(multiplyer));}
__INLINE expr measure() { return expr(AD_MES, NULL, NULL); }
__INLINE expr condition_etype(ElementType etype, const expr & if_true, const expr & if_false) { return expr(AD_COND, new expr(AD_COND_TYPE,etype), new expr(AD_ALTR, new expr(if_true), new expr(if_false))); }
__INLINE expr condition_marker(MIDType marker, const expr & if_true, const expr & if_false) { return expr(AD_COND, new expr(AD_COND_MARK,marker), new expr(AD_ALTR, new expr(if_true), new expr(if_false))); }
__INLINE expr condition_marker(MarkerType marker, const expr & if_true, const expr & if_false) { return expr(AD_COND, new expr(AD_COND_MARK,marker), new expr(AD_ALTR, new expr(if_true), new expr(if_false))); }
__INLINE expr condition(const expr & cond, const expr & if_true, const expr & if_false) { return expr(AD_COND, new expr(cond), new expr(AD_ALTR, new expr(if_true), new expr(if_false))); }
__INLINE expr stencil(INMOST_DATA_ENUM_TYPE stncl, const expr & v) { assert(stncl >= AD_STNCL && stncl < AD_TABLE); return expr(stncl, new expr(v), NULL); }
__INLINE expr tabval(INMOST_DATA_ENUM_TYPE tabl, const expr & v) { assert(tabl >= AD_TABLE && tabl < AD_FUNC); return expr(tabl, new expr(v), NULL); }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment