コード例 #1
0
void 
twoD_diffusion_problem<Scalar,MeshScalar,BasisScalar,LocalOrdinal,GlobalOrdinal,
		       Node>::
computeResponse(const Tpetra_Vector& x,
		const Tpetra_Vector& p,
		Tpetra_Vector& g)
{
  // g = average of x
  Teuchos::ArrayRCP<Scalar> g_view = g.get1dViewNonConst();
  x.meanValue(g_view());
  g_view[0] *= Scalar(x.getGlobalLength()) / Scalar(mesh.size());
}
コード例 #2
0
void Albany::AlbanyPeridigmOBCFunctional::
evaluateResponseT(const double current_time,
     const Tpetra_Vector* xdotT,
     const Tpetra_Vector* xdotdotT,
     const Tpetra_Vector& xT,
     const Teuchos::Array<ParamVec>& p,
     Tpetra_Vector& gT)
{
  LCM::PeridigmManager& peridigmManager = *LCM::PeridigmManager::self();
  Teuchos::ArrayRCP<ST> gT_nonconstView = gT.get1dViewNonConst();
  peridigmManager.obcOverlappingElementSearch();
  gT_nonconstView[0] = peridigmManager.obcEvaluateFunctional();
}
コード例 #3
0
void
Albany::SolutionTwoNormResponseFunction::
evaluateResponseT(const double current_time,
		 const Tpetra_Vector* xdotT,
		 const Tpetra_Vector* xdotdotT,
		 const Tpetra_Vector& xT,
		 const Teuchos::Array<ParamVec>& p,
		 Tpetra_Vector& gT)
{
  Teuchos::ScalarTraits<ST>::magnitudeType twonorm = xT.norm2();
  Teuchos::ArrayRCP<ST> gT_nonconstView = gT.get1dViewNonConst(); 
  gT_nonconstView[0] = twonorm;
}
コード例 #4
0
void
Albany::SolutionMaxValueResponseFunction::
evaluateResponseT(const double current_time,
		 const Tpetra_Vector* xdotT,
		 const Tpetra_Vector* xdotdotT,
		 const Tpetra_Vector& xT,
		 const Teuchos::Array<ParamVec>& p,
		 Tpetra_Vector& gT)
{
  int index;
  Teuchos::ArrayRCP<ST> gT_nonconstView = gT.get1dViewNonConst();
  computeMaxValueT(xT, gT_nonconstView[0], index);
}
コード例 #5
0
void
Albany::SolutionAverageResponseFunction::
evaluateResponseT(const double current_time,
		 const Tpetra_Vector* xdotT,
		 const Tpetra_Vector* xdotdotT,
		 const Tpetra_Vector& xT,
		 const Teuchos::Array<ParamVec>& p,
		 Tpetra_Vector& gT)
{
  ST mean = xT.meanValue();
  Teuchos::ArrayRCP<ST> gT_nonconstView = gT.get1dViewNonConst();
  gT_nonconstView[0] = mean; 
}