Changeset ac6d04 for src/solver/solver_singular.cpp
- Timestamp:
- Apr 10, 2012, 1:55:49 PM (14 years ago)
- Children:
- a40eea
- Parents:
- d24c2f
- File:
-
- 1 edited
-
src/solver/solver_singular.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/solver/solver_singular.cpp
rd24c2f rac6d04 42 42 43 43 // Make sure that arrays are big enough to hold expanded system of equations 44 this->Realloc(rhs.Global(). SizeGlobal().Product() + 1);44 this->Realloc(rhs.Global().GlobalSize().Product() + 1); 45 45 46 46 for (grid_iter = rhs.Iterators().Local().Begin(); grid_iter != rhs.Iterators().Local().End(); ++grid_iter) { 47 47 48 48 // Compute 1-dimensional index from 3-dimensional grid 49 index = rhs.GlobalLinearIndex(*grid_iter - rhs.Local().Begin() + rhs.Global(). BeginLocal());49 index = rhs.GlobalLinearIndex(*grid_iter - rhs.Local().Begin() + rhs.Global().LocalBegin()); 50 50 51 51 // Check if we computed the index correctly … … 64 64 for (stencil_iter = A.begin(); stencil_iter != A.end(); ++stencil_iter) { 65 65 66 i = *grid_iter - rhs.Local().Begin() + rhs.Global(). BeginLocal() + stencil_iter->Disp();66 i = *grid_iter - rhs.Local().Begin() + rhs.Global().LocalBegin() + stencil_iter->Disp(); 67 67 68 68 for (int j=0; j<3; ++j) 69 69 if (comm->BoundaryConditions()[j] == Periodic) { 70 70 if (i[j] < 0) 71 i[j] += rhs.Global(). SizeGlobal()[j];72 else if (i[j] >= rhs.Global(). SizeGlobal()[j])73 i[j] -= rhs.Global(). SizeGlobal()[j];71 i[j] += rhs.Global().GlobalSize()[j]; 72 else if (i[j] >= rhs.Global().GlobalSize()[j]) 73 i[j] -= rhs.Global().GlobalSize()[j]; 74 74 } 75 75 … … 87 87 row_sum += iter->Val(); 88 88 89 if ( fabs(row_sum) <=std::numeric_limits<vmg_float>::epsilon()) {89 if (std::abs(row_sum) <= (A.size()+1) * std::numeric_limits<vmg_float>::epsilon()) { 90 90 91 91 // Expand equation system in order to make the system regular. … … 108 108 { 109 109 int index; 110 const vmg_float correction = this->Sol(this->Size()-1); 110 111 111 112 for (int i=0; i<sol.Local().Size().X(); i++) … … 114 115 115 116 // Compute global 1-dimensional index 116 index = sol.GlobalLinearIndex(sol.Global(). BeginLocal().X()+i,117 sol.Global(). BeginLocal().Y()+j,118 sol.Global(). BeginLocal().Z()+k);117 index = sol.GlobalLinearIndex(sol.Global().LocalBegin().X()+i, 118 sol.Global().LocalBegin().Y()+j, 119 sol.Global().LocalBegin().Z()+k); 119 120 120 121 // Set solution 121 sol(sol.Local().Begin().X()+i, sol.Local().Begin().Y()+j, sol.Local().Begin().Z()+k) = this->Sol(index) ;122 sol(sol.Local().Begin().X()+i, sol.Local().Begin().Y()+j, sol.Local().Begin().Z()+k) = this->Sol(index) - correction; 122 123 123 124 }
Note:
See TracChangeset
for help on using the changeset viewer.
