28 #include <lifev/core/LifeV.hpp> 30 #include <lifev/fsi/solver/MonolithicBlockComposed.hpp> 40 void MonolithicBlockComposed::GlobalAssemble()
42 for (UInt k = 0; k < M_blocks.size(); ++k)
44 M_blocks[k]->globalAssemble();
52 void MonolithicBlockComposed::blockAssembling()
54 for (UInt k = 0; k < M_blocks.size(); ++k)
66 void MonolithicBlockComposed::coupler ( mapPtr_Type& map,
67 const std::map<ID, ID>& locDofMap,
68 const vectorPtr_Type& numerationInterface,
70 const Real& coefficient,
71 const Real& rescaleFactor,
74 matrixPtr_Type coupling (
new matrix_Type (*map) );
75 couplingMatrix ( coupling, (*M_couplingFlags) [couplingBlock], M_FESpace, M_offset, locDofMap, numerationInterface, timeStep, 1., coefficient, rescaleFactor);
76 UInt totalDofs ( map->map (Unique)->NumGlobalElements() );
78 coupling->insertValueDiagonal ( 1., 0 , M_offset[couplingBlock] );
79 coupling->insertValueDiagonal ( 1., M_offset[couplingBlock] + M_FESpace[couplingBlock]->map().map (Unique)->NumGlobalElements(), totalDofs );
81 if (couplingBlock != M_coupling.size() + 1)
83 M_coupling.insert (M_coupling.begin() + couplingBlock, coupling);
87 M_coupling.push_back (coupling);
91 void MonolithicBlockComposed::push_back_matrix (
const matrixPtr_Type& Mat,
const bool recompute)
93 M_blocks.push_back (Mat);
94 M_recompute[M_blocks.size() - 1] = recompute;
97 void MonolithicBlockComposed::push_back_oper ( MonolithicBlockComposed& Oper)
99 super_Type::push_back_oper ( Oper );
100 M_coupling.insert (M_coupling.end(), Oper.couplingVector().begin(), Oper.couplingVector().end() );
104 MonolithicBlockComposed::push_back_coupling ( matrixPtr_Type& coupling )
106 M_coupling.push_back (coupling);
109 void MonolithicBlockComposed::replace_matrix (
const matrixPtr_Type& Mat,
UInt position )
111 M_blocks[position] = Mat;
114 void MonolithicBlockComposed::replace_coupling (
const matrixPtr_Type& Mat,
UInt position )
116 M_coupling[position] = Mat;
119 void MonolithicBlockComposed::addToCoupling (
const matrixPtr_Type& Mat,
UInt position)
121 Mat->globalAssemble();
122 *M_coupling[position] += *Mat;
125 void MonolithicBlockComposed::addToCoupling (
const Real& entry ,
UInt row,
UInt col,
UInt position )
127 if (!M_coupling[position]->matrixPtr()->Filled() )
129 M_coupling[position]->setCoefficient (row, col, entry);
133 matrixPtr_Type tmp (
new matrix_Type (M_coupling[position]->map() ) );
134 *tmp += *M_coupling[position];
135 tmp->setCoefficient (row, col, entry);
136 M_coupling[position] = tmp;
145 void MonolithicBlockComposed::blockAssembling (
const UInt k)
147 if (M_blocks[k]->matrixPtr()->Filled() )
149 matrixPtr_Type tmp (
new matrix_Type (M_blocks[0]->map(), 1) );
150 *tmp += *M_blocks[k];
153 M_coupling[k]->globalAssemble();
154 *M_blocks[k] += *M_coupling[k];
157 void MonolithicBlockComposed::swap (
const UInt i,
const UInt j)
159 super_Type::swap (M_blocks[i], M_blocks[j]);
160 super_Type::swap (M_bch[i], M_bch[j]);
161 super_Type::swap (M_FESpace[i], M_FESpace[j]);
162 super_Type::swap (M_coupling[i], M_coupling[j]);
164 bool tmpRecompute =
this->M_recompute[i];
165 this->M_recompute[i] =
this->M_recompute[j];
166 this->M_recompute[j] = tmpRecompute;
168 UInt tmpOffset =
this->M_offset[i];
169 this->M_offset[i] =
this->M_offset[j];
170 this->M_offset[j] = tmpOffset;
173 const UInt MonolithicBlockComposed::whereIsBlock (
UInt position )
const 175 for (UInt i = 0; i < M_blockReordering->size(); i++)
177 if ( (*M_blockReordering) [i] ==
static_cast<Int>(position) )
182 ERROR_MSG (
"requested a block that does not exist in MonolithicBlockComposed.cpp");
void updateInverseJacobian(const UInt &iQuadPt)
double Real
Generic real data.
uint32_type UInt
generic unsigned integer (used mainly for addressing)