Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef ALBANY_SOLUTIONFILERESPONSEFUNCTION_HPP
00008 #define ALBANY_SOLUTIONFILERESPONSEFUNCTION_HPP
00009
00010 #include "Albany_SamplingBasedScalarResponseFunction.hpp"
00011
00012 namespace Albany {
00013
00017 template<class VectorNorm>
00018 class SolutionFileResponseFunction :
00019 public SamplingBasedScalarResponseFunction {
00020 public:
00021
00023 SolutionFileResponseFunction(const Teuchos::RCP<const Epetra_Comm>& comm);
00024
00026 virtual ~SolutionFileResponseFunction();
00027
00029 virtual unsigned int numResponses() const;
00030
00032 virtual void
00033 evaluateResponse(const double current_time,
00034 const Epetra_Vector* xdot,
00035 const Epetra_Vector* xdotdot,
00036 const Epetra_Vector& x,
00037 const Teuchos::Array<ParamVec>& p,
00038 Epetra_Vector& g);
00039
00041 virtual void
00042 evaluateTangent(const double alpha,
00043 const double beta,
00044 const double omega,
00045 const double current_time,
00046 bool sum_derivs,
00047 const Epetra_Vector* xdot,
00048 const Epetra_Vector* xdotdot,
00049 const Epetra_Vector& x,
00050 const Teuchos::Array<ParamVec>& p,
00051 ParamVec* deriv_p,
00052 const Epetra_MultiVector* Vxdot,
00053 const Epetra_MultiVector* Vxdotdot,
00054 const Epetra_MultiVector* Vx,
00055 const Epetra_MultiVector* Vp,
00056 Epetra_Vector* g,
00057 Epetra_MultiVector* gx,
00058 Epetra_MultiVector* gp);
00059
00061 virtual void
00062 evaluateGradient(const double current_time,
00063 const Epetra_Vector* xdot,
00064 const Epetra_Vector* xdotdot,
00065 const Epetra_Vector& x,
00066 const Teuchos::Array<ParamVec>& p,
00067 ParamVec* deriv_p,
00068 Epetra_Vector* g,
00069 Epetra_MultiVector* dg_dx,
00070 Epetra_MultiVector* dg_dxdot,
00071 Epetra_MultiVector* dg_dxdotdot,
00072 Epetra_MultiVector* dg_dp);
00073
00074 private:
00075
00077 SolutionFileResponseFunction(const SolutionFileResponseFunction&);
00078
00080 SolutionFileResponseFunction& operator=(const SolutionFileResponseFunction&);
00081
00083 Epetra_Vector* RefSoln;
00084
00085 bool solutionLoaded;
00086
00088 int MatrixMarketFileToVector( const char *filename, const Epetra_BlockMap & map, Epetra_Vector * & A);
00089 int MatrixMarketFileToMultiVector( const char *filename, const Epetra_BlockMap & map, Epetra_MultiVector * & A);
00090
00091 };
00092
00093
00094
00095 struct NormTwo {
00096
00097 double Norm(const Epetra_Vector& vec){ double norm; vec.Norm2(&norm); return norm * norm;}
00098
00099 };
00100
00101 struct NormInf {
00102
00103 double Norm(const Epetra_Vector& vec){ double norm; vec.NormInf(&norm); return norm;}
00104
00105 };
00106
00107
00108 }
00109
00110
00111 #define SOLFILERESP_INSTANTIATE_TEMPLATE_CLASS_NORMTWO(name) \
00112 template class name<Albany::NormTwo>;
00113 #define SOLFILERESP_INSTANTIATE_TEMPLATE_CLASS_NORMINF(name) \
00114 template class name<Albany::NormInf>;
00115
00116 #define SOLFILERESP_INSTANTIATE_TEMPLATE_CLASS(name) \
00117 SOLFILERESP_INSTANTIATE_TEMPLATE_CLASS_NORMTWO(name) \
00118 SOLFILERESP_INSTANTIATE_TEMPLATE_CLASS_NORMINF(name)
00119
00120 #endif // ALBANY_SOLUTIONFILERESPONSEFUNCTION_HPP