Commit 0a11ce1e authored by SilverLife's avatar SilverLife
Browse files

Fixed exchange data for reference bug. Resolve deadlocks in AdaptiveMesh example.

parent 3624f499
...@@ -562,7 +562,6 @@ namespace INMOST ...@@ -562,7 +562,6 @@ namespace INMOST
ReleaseMarker(mark_hanging_nodes); ReleaseMarker(mark_hanging_nodes);
ReleaseMarker(mark_cell_edges); ReleaseMarker(mark_cell_edges);
DeleteTag(internal_face_edges); DeleteTag(internal_face_edges);
//ExchangeData(hanging_nodes,CELL | FACE,0);
//10.jump to later schedule, and go to 7. //10.jump to later schedule, and go to 7.
schedule_counter--; schedule_counter--;
} }
...@@ -603,6 +602,7 @@ namespace INMOST ...@@ -603,6 +602,7 @@ namespace INMOST
//14. Done //14. Done
//cout << rank << ": Before end " << endl; //cout << rank << ": Before end " << endl;
EndModification(); EndModification();
ExchangeData(hanging_nodes,CELL | FACE,0);
//cout << rank << ": After end " << endl; //cout << rank << ": After end " << endl;
//reorder element's data to free up space //reorder element's data to free up space
ReorderEmpty(CELL|FACE|EDGE|NODE); ReorderEmpty(CELL|FACE|EDGE|NODE);
...@@ -896,7 +896,6 @@ namespace INMOST ...@@ -896,7 +896,6 @@ namespace INMOST
} }
} }
//jump to later schedule //jump to later schedule
//ExchangeData(hanging_nodes,CELL | FACE,0);
schedule_counter--; schedule_counter--;
} }
//free created tag //free created tag
...@@ -909,6 +908,7 @@ namespace INMOST ...@@ -909,6 +908,7 @@ namespace INMOST
ApplyModification(); ApplyModification();
//done //done
EndModification(); EndModification();
ExchangeData(hanging_nodes,CELL | FACE,0);
//cleanup null links to hanging nodes //cleanup null links to hanging nodes
for(ElementType etype = FACE; etype <= CELL; etype = NextElementType(etype)) for(ElementType etype = FACE; etype <= CELL; etype = NextElementType(etype))
{ {
......
...@@ -74,7 +74,9 @@ int main(int argc, char ** argv) ...@@ -74,7 +74,9 @@ int main(int argc, char ** argv)
m.Save(file.str()); m.Save(file.str());
} }
*/ */
if( !m.Refine(indicator) ) break; int res = m.Refine(indicator);
res = m.Integrate(res);
if (!res) break;
{ {
std::stringstream file; std::stringstream file;
......
...@@ -44,7 +44,7 @@ namespace INMOST ...@@ -44,7 +44,7 @@ namespace INMOST
case DATA_INTEGER: return sizeof(INMOST_DATA_INTEGER_TYPE); case DATA_INTEGER: return sizeof(INMOST_DATA_INTEGER_TYPE);
case DATA_REAL: return sizeof(INMOST_DATA_REAL_TYPE); case DATA_REAL: return sizeof(INMOST_DATA_REAL_TYPE);
case DATA_REMOTE_REFERENCE: throw -1; //todo, exchange of this data type is not yet supported case DATA_REMOTE_REFERENCE: throw -1; //todo, exchange of this data type is not yet supported
case DATA_REFERENCE: throw -1; //todo, exchange of this data type is not yet supported case DATA_REFERENCE: return sizeof(HandleType); //todo, exchange of this data type is not yet supported
#if defined(USE_AUTODIFF) #if defined(USE_AUTODIFF)
case DATA_VARIABLE: return sizeof(Sparse::Row::entry); case DATA_VARIABLE: return sizeof(Sparse::Row::entry);
#endif #endif
......
...@@ -1689,6 +1689,8 @@ namespace INMOST ...@@ -1689,6 +1689,8 @@ namespace INMOST
void Mesh::ResolveModification(int metric) void Mesh::ResolveModification(int metric)
{ {
int rank = GetProcessorRank(); int rank = GetProcessorRank();
int size = GetProcessorsNumber();
if (size == 1) return;
Tag tag = CreateTag("TEMP_DISTANSE",DATA_REAL,CELL,CELL,2); Tag tag = CreateTag("TEMP_DISTANSE",DATA_REAL,CELL,CELL,2);
stringstream ss; stringstream ss;
......
...@@ -2552,7 +2552,14 @@ namespace INMOST ...@@ -2552,7 +2552,14 @@ namespace INMOST
if (FindSharedGhost(global_id,GetHandleElementNum(data),target)) if (FindSharedGhost(global_id,GetHandleElementNum(data),target))
{ {
TagReferenceArray ref_tag = tag; TagReferenceArray ref_tag = tag;
ref_tag[*eit].push_back(target);
reference_array refs = ReferenceArray(*eit, ref_tag);
bool already_exist = false;
for(Storage::reference_array::size_type i = 0; i < refs.size(); ++i)
{
if (target == refs[i].GetHandle()) already_exist = true;
}
if (!already_exist) ref_tag[*eit].push_back(target);
} }
} }
} }
...@@ -2673,7 +2680,7 @@ namespace INMOST ...@@ -2673,7 +2680,7 @@ namespace INMOST
/////////// ///////////
if ( block_recursion == 0) if ( block_recursion == 0)
{ {
bool call_exchange = false; int call_exchange = 0;
for(unsigned int k = 0; k < tags.size(); k++) for(unsigned int k = 0; k < tags.size(); k++)
{ {
if(tags[k].GetDataType() == DATA_REFERENCE) if(tags[k].GetDataType() == DATA_REFERENCE)
...@@ -2695,7 +2702,7 @@ namespace INMOST ...@@ -2695,7 +2702,7 @@ namespace INMOST
for(ElementSet child = set.GetChild(); child.isValid(); child = child.GetSibling()) for(ElementSet child = set.GetChild(); child.isValid(); child = child.GetSibling())
{ {
child.IntegerArray(tag_sendto).push_back(*p); child.IntegerArray(tag_sendto).push_back(*p);
call_exchange = true; call_exchange = 1;
} }
} }
else else
...@@ -2704,7 +2711,7 @@ namespace INMOST ...@@ -2704,7 +2711,7 @@ namespace INMOST
{ {
if (refs[i] == InvalidElement()) continue; if (refs[i] == InvalidElement()) continue;
refs[i].IntegerArray(tag_sendto).push_back(*p); refs[i].IntegerArray(tag_sendto).push_back(*p);
call_exchange = true; call_exchange = 1;
} }
} }
} }
...@@ -2712,6 +2719,7 @@ namespace INMOST ...@@ -2712,6 +2719,7 @@ namespace INMOST
} }
} }
} }
call_exchange = Integrate(call_exchange);
if( call_exchange ) if( call_exchange )
{ {
block_recursion = 1; block_recursion = 1;
......
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