36 #include<lifev/core/operator
/ConfinedOperator.hpp> 62 ASSERT ( M_oper.get() != 0,
"ConfinedOperator::SetUseTranspose: Error: M_oper pointer is null" );
63 return M_oper->SetUseTranspose ( useTranspose );
75 M_map.reset (
new Epetra_Map ( * ( map.map (Unique) ) ) );
81 M_blockStructure.setBlockStructure ( blockStructure );
87 ASSERT ( M_blockStructure.numBlocks() > 0,
"ConfinedOperator::setBlockIndex: Error: M_structure is not initialized" );
88 ASSERT ( index < M_blockStructure.numBlocks(),
"ConfinedOperator::setBlockIndex: Error: index out of range" );
95 ASSERT ( M_oper.get() != 0,
"ConfinedOperator::Apply: Error: M_oper pointer is null" );
96 ASSERT ( M_blockStructure.numBlocks() > 0,
"ConfinedOperator::Apply: Error: M_structure is not initialized" );
97 ASSERT ( X.MyLength() == Y.MyLength(),
"ConfinedOperator::Apply: Error: X and Y must have the same length" );
99 int firstIndex = M_blockStructure.blockFirstIndex ( M_blockIndex );
100 Epetra_MultiVector xtmp ( M_oper->OperatorDomainMap(), 1 );
101 Epetra_MultiVector ytmp ( M_oper->OperatorRangeMap() , 1 );
104 const Int* gids = M_oper->OperatorDomainMap().MyGlobalElements();
105 const UInt numMyEntries = M_oper->OperatorDomainMap().NumMyElements();
108 for (
UInt i = 0; i < numMyEntries; ++i )
110 lid1 = X.Map().LID ( gids[i] + firstIndex );
111 lid2 = M_oper->OperatorDomainMap().LID ( gids[i] );
112 ASSERT ( ( lid2 >= 0 ) && ( lid1 >= 0 ),
"ConfinedOperator::Apply: Error: lid < 0" );
113 xtmp[0][lid2] = X[0][lid1];
117 int result = M_oper->Apply ( xtmp, ytmp );
121 const Int* gids2 = M_oper->OperatorRangeMap().MyGlobalElements();
122 const UInt numMyEntries2 = M_oper->OperatorRangeMap().NumMyElements();
123 for (
UInt i = 0; i < numMyEntries2; ++i )
125 lid1 = Y.Map().LID ( gids2[i] + firstIndex );
126 lid2 = M_oper->OperatorRangeMap().LID ( gids2[i] );
127 ASSERT ( ( lid2 >= 0 ) && ( lid1 >= 0 ),
"ConfinedOperator::Apply: Error: lid < 0" );
128 Y[0][lid1] = ytmp[0][lid2];
137 ASSERT ( M_oper.get() != 0,
"ConfinedOperator::ApplyInverse: Error: M_oper pointer is null" );
138 ASSERT ( M_blockStructure.numBlocks() > 0,
"ConfinedOperator::ApplyInverse: Error: M_structure is not initialized" );
139 ASSERT ( X.MyLength() == Y.MyLength(),
"ConfinedOperator::ApplyInverse: Error: X and Y must have the same length" );
141 int firstIndex = M_blockStructure.blockFirstIndex ( M_blockIndex );
142 Epetra_MultiVector xtmp ( M_oper->OperatorRangeMap() , 1 );
143 Epetra_MultiVector ytmp ( M_oper->OperatorDomainMap(), 1 );
146 const Int* gids = M_oper->OperatorRangeMap().MyGlobalElements();
147 const UInt numMyEntries = M_oper->OperatorRangeMap().NumMyElements();
150 for (
UInt i = 0; i < numMyEntries; ++i )
152 lid1 = X.Map().LID ( gids[i] + firstIndex );
153 lid2 = M_oper->OperatorRangeMap().LID ( gids[i] );
154 ASSERT ( ( lid2 >= 0 ) && ( lid1 >= 0 ),
"ConfinedOperator::ApplyInverse: Error: lid < 0" );
155 xtmp[0][lid2] = X[0][lid1];
159 int result = M_oper->ApplyInverse ( xtmp, ytmp );
163 const Int* gids2 = M_oper->OperatorDomainMap().MyGlobalElements();
164 const UInt numMyEntries2 = M_oper->OperatorDomainMap().NumMyElements();
165 for (
UInt i = 0; i < numMyEntries2; ++i )
167 lid1 = Y.Map().LID ( gids2[i] + firstIndex );
168 lid2 = M_oper->OperatorDomainMap().LID ( gids2[i] );
169 ASSERT ( ( lid2 >= 0 ) && ( lid1 >= 0 ),
"ConfinedOperator::Apply: Error: lid < 0" );
170 Y[0][lid1] = ytmp[0][lid2];
179 ASSERT ( M_oper.get() != 0,
"ConfinedOperator::NormInf: Error: M_oper pointer is null" );
180 return M_oper->NormInf();
186 ASSERT ( M_oper.get() != 0,
"ConfinedOperator::Label: Error: M_oper pointer is null" );
187 return M_oper->Label();
193 ASSERT ( M_oper.get() != 0,
"ConfinedOperator::UseTranspose: Error: M_oper pointer is null" );
194 return M_oper->UseTranspose();
200 ASSERT ( M_oper.get() != 0,
"ConfinedOperator::HasNormInf: Error: M_oper pointer is null" );
201 return M_oper->HasNormInf();
207 ASSERT ( M_oper.get() != 0,
"ConfinedOperator::Comm: Error: M_oper pointer is null" );
208 return M_oper->Comm();
214 ASSERT ( M_blockStructure.numBlocks() > 0,
"ConfinedOperator::OperatorDomainMap: Error: the structure is not known" );
221 ASSERT ( M_blockStructure.numBlocks() > 0,
"ConfinedOperator::OperatorRangeMap: Error: the structure is not known" );
void setBlockStructure(const blockStructure_Type &blockStructure)
Epetra_MultiVector vector_Type
double NormInf() const
Returns the infinity norm of the global matrix.
int32_type Int
Generic integer data.
virtual const map_Type & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
void updateInverseJacobian(const UInt &iQuadPt)
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
VectorBlockStructure blockStructure_Type
void setOperator(operatorPtr_Type oper)
Epetra_Import const & importer()
Getter for the Epetra_Import.
std::shared_ptr< operator_Type > operatorPtr_Type
void setFullMap(const MapEpetra &map)
void setBlockIndex(UInt index)
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
virtual const comm_Type & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
virtual const map_Type & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
virtual const char * Label() const
Returns a character string describing the operator.
ConfinedOperator(std::shared_ptr< Epetra_Comm > comm=std::shared_ptr< Epetra_Comm >(new Epetra_MpiComm(MPI_COMM_WORLD)))
null constructor and destructor
virtual int Apply(const vector_Type &X, vector_Type &Y) const
Returns the result of a Epetra_Operator applied to a vector_Type X in Y.
virtual int SetUseTranspose(bool useTranspose)
If set true, transpose of this operator will be applied.
virtual int ApplyInverse(const vector_Type &X, vector_Type &Y) const
Returns the result of a Epetra_Operator inverse applied to an vector_Type X in Y. ...
uint32_type UInt
generic unsigned integer (used mainly for addressing)