32 #include <feel/feelcore/feel.hpp>
44 std::string _o( std::string
const& prefix, std::string
const& opt )
46 std::string o = prefix;
59 template<
typename ModelType>
66 typedef boost::shared_ptr<crbmodel_type> crbmodel_ptrtype;
76 PFemApp(
int argc,
char** argv,
AboutData const& ad, po::options_description
const& od )
84 std::srand( static_cast<unsigned>( std::time( 0 ) ) );
87 % this->
about().appName()
88 % this->
vm()[
"hsize"].
template as<double>()
90 std::cout <<
"[PFemApp] build model " << this->
about().
appName() <<
"\n";
93 std::cout <<
"build model " << this->
about().
appName() <<
" done\n";
97 if ( this->
vm().count(
"help" ) )
103 typename crbmodel_type::parameter_type mu( model->parameterSpace() );
104 int mutype = this->
vm()[_o( this->
about().appName(),
"mu-type" )].template as<int>();
108 bool broadcast =
true;
109 mu = crbmodel_type::parameterspace_type::logRandom( model->parameterSpace(), broadcast );
112 else if ( mutype == 1 )
114 mu = model->parameterSpace()->min();
117 else if ( mutype == 2 )
120 mu = model->parameterSpace()->max();
125 mu = model->parameterSpace()->max();
128 std::cout <<
"[PFemApp] running " << this->
about().
appName() <<
" with mu = [";
129 int size = mu.size();
131 for (
int i=0; i<size-1; i++ ) std::cout<<mu( i )<<
" , ";
133 std::cout<< mu( size-1 )<<
"] "<<std::endl;
137 auto Xh = model->functionSpace();
138 auto u = Xh->element();
139 bool need_to_solve=
true;
141 for (
int l =0; l < model->Nl(); ++l )
143 double o = model->output( l,mu , u , need_to_solve );
144 std::cout <<
"[PFemApp] output " << l <<
" of " << this->
about().
appName() <<
" = " << o <<
"\n";
148 void run(
const double * X,
unsigned long N,
149 double * Y,
unsigned long P )
152 model->run( X, N, Y, P );
156 crbmodel_ptrtype model;