1 #ifndef __Panzer_ResponseMESupport_Default_hpp__ 2 #define __Panzer_ResponseMESupport_Default_hpp__ 5 #include "Teuchos_ArrayRCP.hpp" 7 #include "Teuchos_OpaqueWrapper.hpp" 11 #include "Thyra_EpetraThyraWrappers.hpp" 13 #include "Thyra_DefaultSpmdVectorSpace.hpp" 14 #include "Thyra_SpmdVectorBase.hpp" 16 #include "Epetra_LocalMap.h" 17 #include "Epetra_Map.h" 21 template <
typename EvalT>
117 {
return derivative_; }
129 if(eMap_==Teuchos::null)
130 eMap_ = Thyra::get_Epetra_Map(*getDerivativeVectorSpace(),Thyra::get_Epetra_Comm(*
tComm_));
145 derivative_ = Thyra::create_MultiVector(derivative,getDerivativeVectorSpace());
157 return Thyra::createMember(*getDerivativeVectorSpace());
168 derivative_ = derivative;
177 {
return derivVecSpace_; }
181 { derivVecSpace_ = vs; }
220 "Reponse field \"" << this->
getName() <<
"\" has previously been initialized as a " 221 "Thyra object, now trying to initalize as a Epetra! Error!");
223 if(
map_==Teuchos::null) {
237 "Reponse field \"" << this->
getName() <<
"\" has previously been initialized as a " 238 "Thyra object, now trying to initalize as a Epetra! Error!");
249 "Reponse field \"" << this->
getName() <<
"\" has previously been initialized as an " 250 "Epetra object, now trying to initalize as a Thyra object! Error!");
266 "Reponse field \"" << this->
getName() <<
"\" has previously been initialized as an " 267 "Epetra object, now trying to initalize as a Thyra object! Error!");
291 const int num_col =
tVector_->domain()->dim();
292 Thyra::ArrayRCP< Thyra::ArrayRCP<double> > data(num_col);
293 for (
int i=0; i<num_col; ++i)
294 Teuchos::rcp_dynamic_cast<Thyra::SpmdVectorBase<double> >(
tVector_->col(i),
true)->getNonconstLocalData(Teuchos::outArg(data[i]));
323 #ifdef Panzer_BUILD_HESSIAN_SUPPORT 343 bool supportsDerivative()
const {
return getDerivativeVectorSpace()!=Teuchos::null; }
349 {
return derivative_; }
357 return Thyra::createMember(*getDerivativeVectorSpace());
363 virtual void setDerivative(
const Teuchos::RCP<Thyra::MultiVectorBase<double> > & derivative)
368 derivative_ = derivative;
377 {
return derivVecSpace_; }
381 { derivVecSpace_ = vs; }
Teuchos::RCP< Thyra::MultiVectorBase< double > > getDerivative() const
virtual void setDerivative(const Teuchos::RCP< Thyra::MultiVectorBase< double > > &derivative)
virtual ~ResponseMESupport_Default()
ResponseMESupport_Default(const std::string &responseName, MPI_Comm comm)
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > vSpace_
virtual void setDerivative(const Teuchos::RCP< Epetra_MultiVector > &derivative)
Teuchos::RCP< Epetra_Vector > eVector_
bool useThyra() const
Is Thyra the right vector.
void setDerivativeVectorSpace(const Teuchos::RCP< const Thyra::VectorSpaceBase< double > > &vs)
Set the derivative vector space.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > vSpace_
Teuchos::RCP< const Epetra_Map > getMap() const
Get the Epetra_Map for this response, map is constructed lazily.
Teuchos::RCP< const Teuchos::Comm< Thyra::Ordinal > > tComm_
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > derivVecSpace_
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getDerivativeVectorSpace() const
Get the derivative vector space.
bool useEpetra() const
Is Epetra the right vector.
ResponseMESupport_Default()
Teuchos::RCP< Thyra::MultiVectorBase< double > > tVector_
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getVectorSpace() const
Get the vector space for this response, vector space is constructed lazily.
bool useEpetra() const
Is Epetra the right vector.
virtual Teuchos::RCP< Thyra::MultiVectorBase< double > > buildDerivative() const
Get the Epetra_Map for this response, map is constructed lazily.
bool supportsDerivative() const
Does this response support derivative evaluation?
void setVector(const Teuchos::RCP< Thyra::MultiVectorBase< double > > &destVec)
virtual ~ResponseMESupport_Default()
Teuchos::RCP< const Teuchos::Comm< Thyra::Ordinal > > getComm() const
Get the teuchos comm object.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< const Teuchos::Comm< Thyra::Ordinal > > getComm() const
Get the teuchos comm object.
Teuchos::RCP< const Teuchos::Comm< Thyra::Ordinal > > getComm() const
Get the teuchos comm object.
Teuchos::RCP< const Epetra_Map > eMap_
int numDeriv() const
Return the number of columns in the multivector.
Teuchos::RCP< const Teuchos::Comm< Thyra::Ordinal > > tComm_
Teuchos::RCP< const Epetra_Map > map_
Teuchos::RCP< const Teuchos::Comm< Thyra::Ordinal > > tComm_
virtual ~ResponseMESupport_Default()
Teuchos::RCP< const Thyra::VectorSpaceBase< double > > getVectorSpace() const
Get the vector space for this response, vector space is constructed lazily.
virtual std::size_t localSizeRequired() const =0
What is the number of values you need locally.
panzer::Traits::Tangent EvalT
Thyra::ArrayRCP< double > getThyraVector() const
Access the thyra vector.
void setVector(const Teuchos::RCP< Epetra_Vector > &destVec)
Teuchos::RCP< Epetra_MultiVector > eVector_
Teuchos::RCP< Thyra::VectorBase< double > > tVector_
std::string getName() const
Epetra_Vector & getEpetraVector() const
Access the epetra vector.
Teuchos::RCP< const Teuchos::Comm< int > > comm
Thyra::ArrayRCP< Thyra::ArrayRCP< double > > getThyraMultiVector() const
Access the thyra vector.
Epetra_MultiVector & getEpetraMultiVector() const
Access the epetra vector.
void setVector(const Teuchos::RCP< Epetra_MultiVector > &destVec)
Teuchos::RCP< const Epetra_Map > getMap() const
Get the Epetra_Map for this response, map is constructed lazily.
#define TEUCHOS_ASSERT(assertion_test)
bool useThyra() const
Is Thyra the right vector.
ResponseMESupport_Default(const std::string &responseName, MPI_Comm comm, const Teuchos::RCP< const Thyra::VectorSpaceBase< double > > &derivVecSpace=Teuchos::null)
virtual bool vectorIsDistributed() const =0
Is the vector distributed (or replicated)
ResponseMESupport_Default(const std::string &responseName, MPI_Comm comm)
virtual Teuchos::RCP< Epetra_MultiVector > buildEpetraDerivative() const
Get the Epetra_Map for this response, map is constructed lazily.
Teuchos::RCP< Thyra::MultiVectorBase< double > > derivative_
Teuchos::RCP< const Epetra_Map > map_