Commit ec795ab1 authored by Kirill Terekhov's avatar Kirill Terekhov

Bug fix

Fix a bug that lead to exception when packing variable-sized data with
zero size.

Do not shift cell centers for eclipse grids when edges are curvilinear.
(another algorithm is needed to fix cell centers that are outside of
cells)
parent 6326e7ba
......@@ -133,6 +133,7 @@ int main(int argc,char ** argv)
ttt = Timer();
Solver S(Solver::INNER_ILU2); // Specify the linear solver to ASM+ILU2+BiCGStab one
S.SetParameterReal("absolute_tolerance",1e-8);
S.SetParameterEnum("schwartz_overlap",2);
Residual R; // Residual vector
Sparse::LockService Locks;
Sparse::Vector Update; // Declare the solution and the right-hand side vectors
......
......@@ -2813,40 +2813,41 @@ ecl_exit_loop:
}
}
//compute cell centers that lay inside
GeomParam table;
table[CENTROID] = CELL;
PrepareGeometricData(table);
//overwrite centroid info
if( !curvilinear_edges )
{
GeomParam table;
table[CENTROID] = CELL;
PrepareGeometricData(table);
//overwrite centroid info
#if defined(USE_OMP)
#pragma omp parallel for
#endif
for(integer it = 0; it < CellLastLocalID(); ++it) if( isValidCell(it) )
{
Cell c = CellByLocalID(it);
integer bnum = c->Integer(cell_number)-1;
if( bnum >= 0 ) //maybe this cell existed before
for(integer it = 0; it < CellLastLocalID(); ++it) if( isValidCell(it) )
{
real ctop[3] = {0.0,0.0,0.0}, cbottom[3] = {0.0,0.0,0.0};
for(int l = 0; l < 4; ++l)
Cell c = CellByLocalID(it);
integer bnum = c->Integer(cell_number)-1;
if( bnum >= 0 ) //maybe this cell existed before
{
real_array bc = Node(this,block_nodes[bnum*8+l+0]).Coords();
real_array tc = Node(this,block_nodes[bnum*8+l+4]).Coords();
cbottom[0] += bc[0]*0.25;
cbottom[1] += bc[1]*0.25;
cbottom[2] += bc[2]*0.25;
ctop[0] += tc[0]*0.25;
ctop[1] += tc[1]*0.25;
ctop[2] += tc[2]*0.25;
real ctop[3] = {0.0,0.0,0.0}, cbottom[3] = {0.0,0.0,0.0};
for(int l = 0; l < 4; ++l)
{
real_array bc = Node(this,block_nodes[bnum*8+l+0]).Coords();
real_array tc = Node(this,block_nodes[bnum*8+l+4]).Coords();
cbottom[0] += bc[0]*0.25;
cbottom[1] += bc[1]*0.25;
cbottom[2] += bc[2]*0.25;
ctop[0] += tc[0]*0.25;
ctop[1] += tc[1]*0.25;
ctop[2] += tc[2]*0.25;
}
real_array cnt = c->RealArray(centroid_tag);
cnt[0] = (cbottom[0]+ctop[0])*0.5;
cnt[1] = (cbottom[1]+ctop[1])*0.5;
cnt[2] = (cbottom[2]+ctop[2])*0.5;
}
real_array cnt = c->RealArray(centroid_tag);
cnt[0] = (cbottom[0]+ctop[0])*0.5;
cnt[1] = (cbottom[1]+ctop[1])*0.5;
cnt[2] = (cbottom[2]+ctop[2])*0.5;
}
}
int num_outside = 0, num_total = 0;
for(integer it = 0; it < CellLastLocalID(); ++it) if( isValidCell(it) )
{
......
......@@ -2234,13 +2234,16 @@ namespace INMOST
INMOST_DATA_ENUM_TYPE s = GetDataSize(*eit,tag);
INMOST_DATA_ENUM_TYPE had_s = static_cast<INMOST_DATA_ENUM_TYPE>(array_data_send.size());
//array_data_send.resize(had_s+s*tag.GetBytesSize());
array_data_send.resize(had_s+GetDataCapacity(*eit,tag));
GetData(*eit,tag,0,s,&array_data_send[had_s]);
if( s )
{
array_data_send.resize(had_s+GetDataCapacity(*eit,tag));
GetData(*eit,tag,0,s,&array_data_send[had_s]);
//REPORT_VAL("size",s);
//for(int qq = 0; qq < s; ++qq)
//{
// REPORT_VAL("value " << qq, (*(Storage::integer *)&array_data_send[had_s+qq*tag.GetBytesSize()]));
//}
}
if( size == ENUMUNDEF ) array_size_send.push_back(s);
++total_packed;
}
......@@ -2253,9 +2256,12 @@ namespace INMOST
INMOST_DATA_ENUM_TYPE s = GetDataSize(*eit,tag);
INMOST_DATA_ENUM_TYPE had_s = static_cast<INMOST_DATA_ENUM_TYPE>(array_data_send.size());
//array_data_send.resize(had_s+s*tag.GetBytesSize());
array_data_send.resize(had_s+GetDataCapacity(*eit,tag));
GetData(*eit,tag,0,s,&array_data_send[had_s]);
if( size == ENUMUNDEF ) array_size_send.push_back(s);
if( s )
{
array_data_send.resize(had_s+GetDataCapacity(*eit,tag));
GetData(*eit,tag,0,s,&array_data_send[had_s]);
}
if( size == ENUMUNDEF ) array_size_send.push_back(s);
++total_packed;
}
}
......
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