Skip to content

Commit

Permalink
progress on issue #34 in ATO
Browse files Browse the repository at this point in the history
  • Loading branch information
ibaned committed Feb 1, 2017
1 parent c27bf85 commit cabb5a8
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/ATO/evaluators/ATO_HomogenizedConstantsResponse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ namespace ATO

std::string FName;
static const std::string className;
PHX::MDField<ScalarT> field;
PHX::MDField<MeshScalarT,Cell,QuadPoint> weights;
PHX::MDField<const ScalarT> field;
PHX::MDField<const MeshScalarT,Cell,QuadPoint> weights;
Teuchos::RCP< PHX::Tag<ScalarT> > objective_tag;

Kokkos::vector<int> component0, component1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ HomogenizedConstantsResponse(Teuchos::ParameterList& p,
"Invalid field type " << fieldType << ". Support values are " <<
"Scalar, Vector, and Tensor." << std::endl);
}
field = PHX::MDField<ScalarT>(field_name, field_layout);
field = decltype(field)(field_name, field_layout);

int field_rank = field_layout->rank();
tensorRank = field_rank - 2; //first 2 dimensions are cell and qp.
Expand Down
8 changes: 3 additions & 5 deletions src/ATO/evaluators/ATO_InternalEnergyResponse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ namespace ATO
std::string elementBlockName;
static const std::string className;

// PHX::MDField<ScalarT> gradX;
// PHX::MDField<ScalarT> workConj;
PHX::MDField<MeshScalarT,Cell,QuadPoint> qp_weights;
PHX::MDField<RealType,Cell,Node,QuadPoint> BF;
Teuchos::Array<PHX::MDField<ParamScalarT,Cell,Node> > topos;
PHX::MDField<const MeshScalarT,Cell,QuadPoint> qp_weights;
PHX::MDField<const RealType,Cell,Node,QuadPoint> BF;
Teuchos::Array<PHX::MDField<const ParamScalarT,Cell,Node> > topos;


Teuchos::RCP< PHX::Tag<ScalarT> > stiffness_objective_tag;
Expand Down
6 changes: 3 additions & 3 deletions src/ATO/evaluators/ATO_InternalEnergyResponse_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ InternalEnergyResponse(Teuchos::ParameterList& p,
(*topologies)[itopo]->getEntityType() != "Distributed Parameter",
Teuchos::Exceptions::InvalidParameter, std::endl
<< "Error! InternalEnergyResponse requires 'Distributed Parameter' based topology" << std::endl);
topos[itopo] = PHX::MDField<ParamScalarT,Cell,Node>((*topologies)[itopo]->getName(),dl->node_scalar);
topos[itopo] = PHX::MDField<const ParamScalarT,Cell,Node>((*topologies)[itopo]->getName(),dl->node_scalar);
this->addDependentField(topos[itopo]);
}

Expand All @@ -89,7 +89,7 @@ InternalEnergyResponse(Teuchos::ParameterList& p,
this->addDependentField(qp_weights);
this->addDependentField(BF);

Teuchos::Array< PHX::MDField<ScalarT> > depFields;
Teuchos::Array< PHX::MDField<const ScalarT> > depFields;
penaltyModel->getDependentFields(depFields);

int nFields = depFields.size();
Expand Down Expand Up @@ -135,7 +135,7 @@ postRegistrationSetup(typename Traits::SetupData d,
this->utils.setFieldData(qp_weights,fm);
this->utils.setFieldData(BF,fm);

Teuchos::Array<PHX::MDField<ScalarT>* > depFields;
Teuchos::Array<PHX::MDField<const ScalarT>* > depFields;
penaltyModel->getDependentFields(depFields);

int nFields = depFields.size();
Expand Down
12 changes: 6 additions & 6 deletions src/ATO/evaluators/ATO_ModalObjective.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ namespace ATO {
std::string FName;
static const std::string className;

PHX::MDField<MeshScalarT,Cell,QuadPoint> qp_weights;
PHX::MDField<RealType,Cell,Node,QuadPoint> BF;
PHX::MDField<ScalarT,Cell,QuadPoint,Dim> val_qp;
PHX::MDField<ScalarT,Cell,QuadPoint,Dim,Dim> gradX;
PHX::MDField<ScalarT,Cell,QuadPoint,Dim,Dim> workConj;
PHX::MDField<ScalarT> eigval;
PHX::MDField<const MeshScalarT,Cell,QuadPoint> qp_weights;
PHX::MDField<const RealType,Cell,Node,QuadPoint> BF;
PHX::MDField<const ScalarT,Cell,QuadPoint,Dim> val_qp;
PHX::MDField<const ScalarT,Cell,QuadPoint,Dim,Dim> gradX;
PHX::MDField<const ScalarT,Cell,QuadPoint,Dim,Dim> workConj;
PHX::MDField<const ScalarT> eigval;

Teuchos::RCP< PHX::Tag<ScalarT> > modal_objective_tag;
Albany::StateManager* pStateMgr;
Expand Down
4 changes: 2 additions & 2 deletions src/ATO/evaluators/ATO_StiffnessObjective.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ namespace ATO {
std::string elementBlockName;
static const std::string className;

PHX::MDField<MeshScalarT,Cell,QuadPoint> qp_weights;
PHX::MDField<RealType,Cell,Node,QuadPoint> BF;
PHX::MDField<const MeshScalarT,Cell,QuadPoint> qp_weights;
PHX::MDField<const RealType,Cell,Node,QuadPoint> BF;

Teuchos::RCP< PHX::Tag<ScalarT> > stiffness_objective_tag;
Albany::StateManager* pStateMgr;
Expand Down
4 changes: 2 additions & 2 deletions src/ATO/evaluators/ATO_StiffnessObjective_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ StiffnessObjectiveBase(Teuchos::ParameterList& p,
this->addDependentField(qp_weights);
this->addDependentField(BF);

Teuchos::Array< PHX::MDField<ScalarT> > depFields;
Teuchos::Array< PHX::MDField<const ScalarT> > depFields;
penaltyModel->getDependentFields(depFields);

int nFields = depFields.size();
Expand All @@ -88,7 +88,7 @@ postRegistrationSetup(typename Traits::SetupData d,
this->utils.setFieldData(qp_weights,fm);
this->utils.setFieldData(BF,fm);

Teuchos::Array<PHX::MDField<ScalarT>* > depFields;
Teuchos::Array<PHX::MDField<const ScalarT>* > depFields;
penaltyModel->getDependentFields(depFields);

int nFields = depFields.size();
Expand Down
8 changes: 4 additions & 4 deletions src/ATO/evaluators/ATO_TensorPNormResponse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ namespace ATO
void TransformResponse (int Cell, int QP, ScalarT& response_eff);
std::string FName;
static const std::string className;
PHX::MDField<ScalarT> tensor;
PHX::MDField<MeshScalarT,Cell,QuadPoint> qp_weights;
PHX::MDField<RealType,Cell,Node,QuadPoint> BF;
PHX::MDField<ParamScalarT,Cell,Node> topo;
PHX::MDField<const ScalarT> tensor;
PHX::MDField<const MeshScalarT,Cell,QuadPoint> qp_weights;
PHX::MDField<const RealType,Cell,Node,QuadPoint> BF;
PHX::MDField<const ParamScalarT,Cell,Node> topo;
Teuchos::RCP< PHX::Tag<ScalarT> > objective_tag;

Teuchos::RCP<Topology> topology;
Expand Down
5 changes: 2 additions & 3 deletions src/ATO/evaluators/ATO_TensorPNormResponse_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ TensorPNormResponse(Teuchos::ParameterList& p,
"!" << std::endl << "Options are (QP Tensor, QP Vector)" <<
std::endl);

PHX::MDField<ScalarT> _tensor(responseParams->get<std::string>("Tensor Field Name"), layout);
tensor = _tensor;
tensor = decltype(tensor)(responseParams->get<std::string>("Tensor Field Name"), layout);

Teuchos::RCP<Teuchos::ParameterList> paramsFromProblem =
p.get< Teuchos::RCP<Teuchos::ParameterList> >("Parameters From Problem");
Expand Down Expand Up @@ -203,7 +202,7 @@ TensorPNormResponse(Teuchos::ParameterList& p,
Teuchos::Exceptions::InvalidParameter, std::endl
<< "Error! TensorPNormResponse requires 'Distributed Parameter' based topology" << std::endl);

topo = PHX::MDField<ParamScalarT,Cell,Node>(topology->getName(),dl->node_scalar);
topo = decltype(topo)(topology->getName(),dl->node_scalar);

this->pStateMgr = p.get< Albany::StateManager* >("State Manager Ptr");
this->pStateMgr->registerStateVariable("Effective Stress",
Expand Down
18 changes: 9 additions & 9 deletions src/ATO/utils/ATO_PenaltyModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class PenaltyModel {
PenaltyModel( Teuchos::ParameterList& p, const Teuchos::RCP<Albany::Layouts>& dl );
virtual void Evaluate(Teuchos::Array<N>& topoVals, Teuchos::RCP<TopologyArray>& topologies,
int cell, int qp, N& response, Teuchos::Array<N>& dResponse)=0;
virtual void getDependentFields(Teuchos::Array<PHX::MDField<N> >& depFields)=0;
virtual void getDependentFields(Teuchos::Array< PHX::MDField<N>* >& depFields)=0;
virtual void getDependentFields(Teuchos::Array<PHX::MDField<const N> >& depFields)=0;
virtual void getDependentFields(Teuchos::Array< PHX::MDField<const N>* >& depFields)=0;
void getFieldDimensions(std::vector<int>& dims);
protected:
int numDims, rank;
PHX::MDField<N> gradX;
PHX::MDField<const N> gradX;
};
/******************************************************************************/

Expand All @@ -37,15 +37,15 @@ class PenaltyMixture : public PenaltyModel<N> {
const Teuchos::RCP<Albany::Layouts>& dl);
void Evaluate(Teuchos::Array<N>& topoVals, Teuchos::RCP<TopologyArray>& topologies,
int cell, int qp, N& response, Teuchos::Array<N>& dResponse);
void getDependentFields(Teuchos::Array<PHX::MDField<N> >& depFields);
void getDependentFields(Teuchos::Array< PHX::MDField<N>* >& depFields);
void getDependentFields(Teuchos::Array<PHX::MDField<const N> >& depFields);
void getDependentFields(Teuchos::Array< PHX::MDField<const N>* >& depFields);
private:
int topologyIndex;
int functionIndex;
Teuchos::Array<int> materialIndices;
Teuchos::Array<int> mixtureTopologyIndices;
Teuchos::Array<int> mixtureFunctionIndices;
Teuchos::Array<PHX::MDField<N> > workConj;
Teuchos::Array<PHX::MDField<const N> > workConj;
};
/******************************************************************************/

Expand All @@ -63,12 +63,12 @@ class PenaltyMaterial : public PenaltyModel<N> {
const Teuchos::RCP<Albany::Layouts>& dl);
void Evaluate(Teuchos::Array<N>& topoVals, Teuchos::RCP<TopologyArray>& topologies,
int cell, int qp, N& response, Teuchos::Array<N>& dResponse);
void getDependentFields(Teuchos::Array<PHX::MDField<N> >& depFields);
void getDependentFields(Teuchos::Array< PHX::MDField<N>* >& depFields);
void getDependentFields(Teuchos::Array<PHX::MDField<const N> >& depFields);
void getDependentFields(Teuchos::Array< PHX::MDField<const N>* >& depFields);
private:
int topologyIndex;
int functionIndex;
PHX::MDField<N> workConj;
PHX::MDField<const N> workConj;
};
/******************************************************************************/

Expand Down
14 changes: 7 additions & 7 deletions src/ATO/utils/ATO_PenaltyModel_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ PenaltyModel(Teuchos::ParameterList& p, const Teuchos::RCP<Albany::Layouts>& dl)
"!" << std::endl << "Options are (QP Tensor3, QP Tensor, QP Vector)" <<
std::endl);

PHX::MDField<N> _gradX(responseParams->get<std::string>("Gradient Field Name"), layout);
PHX::MDField<const N> _gradX(responseParams->get<std::string>("Gradient Field Name"), layout);
gradX = _gradX;

std::vector<int> dims;
Expand Down Expand Up @@ -63,7 +63,7 @@ PenaltyMixture(Teuchos::ParameterList& blockParams,

workConj.resize(nMats);
for(int imat=0; imat<nMats; imat++){
PHX::MDField<N> _workConj(Albany::strint(workConjBaseName,imat), layout);
PHX::MDField<const N> _workConj(Albany::strint(workConjBaseName,imat), layout);
workConj[imat] = _workConj;
}

Expand Down Expand Up @@ -108,7 +108,7 @@ getFieldDimensions(std::vector<int>& dims)
/******************************************************************************/
template<typename N>
void ATO::PenaltyMixture<N>::
getDependentFields(Teuchos::Array<PHX::MDField<N> >& depFields)
getDependentFields(Teuchos::Array<PHX::MDField<const N> >& depFields)
/******************************************************************************/
{
int nWCs = workConj.size();
Expand All @@ -122,7 +122,7 @@ getDependentFields(Teuchos::Array<PHX::MDField<N> >& depFields)
/******************************************************************************/
template<typename N>
void ATO::PenaltyMixture<N>::
getDependentFields(Teuchos::Array<PHX::MDField<N>* >& depFields)
getDependentFields(Teuchos::Array<PHX::MDField<const N>* >& depFields)
/******************************************************************************/
{
int nWCs = workConj.size();
Expand All @@ -137,7 +137,7 @@ getDependentFields(Teuchos::Array<PHX::MDField<N>* >& depFields)
/******************************************************************************/
template<typename N>
void ATO::PenaltyMaterial<N>::
getDependentFields(Teuchos::Array<PHX::MDField<N> >& depFields)
getDependentFields(Teuchos::Array<PHX::MDField<const N> >& depFields)
/******************************************************************************/
{
depFields.resize(2);
Expand All @@ -148,7 +148,7 @@ getDependentFields(Teuchos::Array<PHX::MDField<N> >& depFields)
/******************************************************************************/
template<typename N>
void ATO::PenaltyMaterial<N>::
getDependentFields(Teuchos::Array<PHX::MDField<N>* >& depFields)
getDependentFields(Teuchos::Array<PHX::MDField<const N>* >& depFields)
/******************************************************************************/
{
depFields.resize(2);
Expand Down Expand Up @@ -181,7 +181,7 @@ PenaltyMaterial(Teuchos::ParameterList& blockParams,
"!" << std::endl << "Options are (QP Tensor3, QP Tensor, QP Vector)" <<
std::endl);

PHX::MDField<N> _workConj(responseParams->get<std::string>("Work Conjugate Name"), layout);
PHX::MDField<const N> _workConj(responseParams->get<std::string>("Work Conjugate Name"), layout);
workConj = _workConj;

topologyIndex = responseParams->get<int>("Topology Index");
Expand Down

0 comments on commit cabb5a8

Please sign in to comment.