{"action":"created","issue":{"url":"https://api.github.com/repos/feelpp/feelpp/issues/534","labels_url":"https://api.github.com/repos/feelpp/feelpp/issues/534/labels{/name}","comments_url":"https://api.github.com/repos/feelpp/feelpp/issues/534/comments","events_url":"https://api.github.com/repos/feelpp/feelpp/issues/534/events","html_url":"https://github.com/feelpp/feelpp/issues/534","id":59354947,"number":534,"title":"Add support for component-wise dirichlet condition in vector fields","user":{"login":"prudhomm","id":151693,"avatar_url":"https://avatars.githubusercontent.com/u/151693?v=3","gravatar_id":"","url":"https://api.github.com/users/prudhomm","html_url":"https://github.com/prudhomm","followers_url":"https://api.github.com/users/prudhomm/followers","following_url":"https://api.github.com/users/prudhomm/following{/other_user}","gists_url":"https://api.github.com/users/prudhomm/gists{/gist_id}","starred_url":"https://api.github.com/users/prudhomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prudhomm/subscriptions","organizations_url":"https://api.github.com/users/prudhomm/orgs","repos_url":"https://api.github.com/users/prudhomm/repos","events_url":"https://api.github.com/users/prudhomm/events{/privacy}","received_events_url":"https://api.github.com/users/prudhomm/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/feelpp/feelpp/labels/module:dsel","name":"module:dsel","color":"bfdadc"},{"url":"https://api.github.com/repos/feelpp/feelpp/labels/status:in%20development","name":"status:in development","color":"fbca04"},{"url":"https://api.github.com/repos/feelpp/feelpp/labels/type:feature","name":"type:feature","color":"55dd00"}],"state":"open","locked":false,"assignee":{"login":"prudhomm","id":151693,"avatar_url":"https://avatars.githubusercontent.com/u/151693?v=3","gravatar_id":"","url":"https://api.github.com/users/prudhomm","html_url":"https://github.com/prudhomm","followers_url":"https://api.github.com/users/prudhomm/followers","following_url":"https://api.github.com/users/prudhomm/following{/other_user}","gists_url":"https://api.github.com/users/prudhomm/gists{/gist_id}","starred_url":"https://api.github.com/users/prudhomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prudhomm/subscriptions","organizations_url":"https://api.github.com/users/prudhomm/orgs","repos_url":"https://api.github.com/users/prudhomm/repos","events_url":"https://api.github.com/users/prudhomm/events{/privacy}","received_events_url":"https://api.github.com/users/prudhomm/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/feelpp/feelpp/milestones/15","html_url":"https://github.com/feelpp/feelpp/milestones/v0.100.0","labels_url":"https://api.github.com/repos/feelpp/feelpp/milestones/15/labels","id":781434,"number":15,"title":"v0.100.0","description":"","creator":{"login":"prudhomm","id":151693,"avatar_url":"https://avatars.githubusercontent.com/u/151693?v=3","gravatar_id":"","url":"https://api.github.com/users/prudhomm","html_url":"https://github.com/prudhomm","followers_url":"https://api.github.com/users/prudhomm/followers","following_url":"https://api.github.com/users/prudhomm/following{/other_user}","gists_url":"https://api.github.com/users/prudhomm/gists{/gist_id}","starred_url":"https://api.github.com/users/prudhomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prudhomm/subscriptions","organizations_url":"https://api.github.com/users/prudhomm/orgs","repos_url":"https://api.github.com/users/prudhomm/repos","events_url":"https://api.github.com/users/prudhomm/events{/privacy}","received_events_url":"https://api.github.com/users/prudhomm/received_events","type":"User","site_admin":false},"open_issues":17,"closed_issues":33,"state":"open","created_at":"2014-09-07T22:40:27Z","updated_at":"2015-02-28T19:40:23Z","due_on":"2015-01-16T23:00:00Z","closed_at":null},"comments":2,"created_at":"2015-02-28T19:40:23Z","updated_at":"2015-03-03T17:02:27Z","closed_at":null,"body":"@lcarichi we should be able to set Dirichlet condition per component of a vector-field."},"comment":{"url":"https://api.github.com/repos/feelpp/feelpp/issues/comments/76986802","html_url":"https://github.com/feelpp/feelpp/issues/534#issuecomment-76986802","issue_url":"https://api.github.com/repos/feelpp/feelpp/issues/534","id":76986802,"user":{"login":"vhuber","id":2920150,"avatar_url":"https://avatars.githubusercontent.com/u/2920150?v=3","gravatar_id":"","url":"https://api.github.com/users/vhuber","html_url":"https://github.com/vhuber","followers_url":"https://api.github.com/users/vhuber/followers","following_url":"https://api.github.com/users/vhuber/following{/other_user}","gists_url":"https://api.github.com/users/vhuber/gists{/gist_id}","starred_url":"https://api.github.com/users/vhuber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vhuber/subscriptions","organizations_url":"https://api.github.com/users/vhuber/orgs","repos_url":"https://api.github.com/users/vhuber/repos","events_url":"https://api.github.com/users/vhuber/events{/privacy}","received_events_url":"https://api.github.com/users/vhuber/received_events","type":"User","site_admin":false},"created_at":"2015-03-03T17:02:26Z","updated_at":"2015-03-03T17:02:26Z","body":"@prudhomm The following code exhibits the behavior I highlighted.\r\nFor various space type, it computes \r\n```c++\r\nauto u = space_type_instance->element();\r\nauto a = form2(space_type_instance,space_type_instance);\r\na += integrate(elements(mesh), _expr=inner(id(u),idt(u)) );\r\n```\r\nThere is a loop over sub spaces if applicable.\r\n\r\nThat produces various matlab matrix (available on hpc-login with `module load matlab/matlab` that can be displayed by the `spy()` function.\r\n\r\nHere is provided the matrix for the HCurl x Lag space type\r\n\r\n![capture d ecran 2015-03-03 a 17 58 32](https://cloud.githubusercontent.com/assets/2920150/6467504/f098d2b4-c1ce-11e4-9fb8-25132261f828.png)\r\n\r\nOther effects can be seen [here](http://my.cdash.org/index.php?project=Feel%2B%2B&display=project&filtercount=3&showfilters=1&filtercombine=and&field1=buildname/string&compare1=61&value1=debian-wheezy-x86_64-gcc-4.8-petsc_3.4.2p0-boost_105500&field2=site/string&compare2=61&value2=cp-debian&field3=buildstamp/string&compare3=61&value3=20150302-2200-Nightly&collapse=0)\r\n\r\n```c++\r\n#include <feel/feel.hpp>\r\n#include <feel/feeldiscr/ned1h.hpp>\r\n\r\nusing namespace Feel;\r\n\r\ntemplate <typename space_ptrtype>\r\nclass getNorm{\r\n\r\n  typedef typename meta::BilinearForm<typename space_ptrtype::element_type, typename space_ptrtype::element_type>::type form2_type;\r\n  public:\r\n  getNorm(space_ptrtype toto, std::string s){\r\n    Xh = toto;\r\n    str = s+\".m\";\r\n    doStuff(mpl::bool_<space_ptrtype::element_type::is_composite>());\r\n  };\r\n  double n1(void){return norm1;}\r\n  double nI(void){return normInf;}\r\n  private:\r\n\r\n  void doStuff(mpl::bool_<false>)\r\n  {\r\n    auto u = Xh->element();\r\n    auto a = form2(Xh,Xh);\r\n    a      = integrate(_range=elements(Xh->mesh()), _expr=inner(id(u),idt(u)));\r\n    norm1   = a.matrixPtr()->l1Norm();\r\n    normInf = a.matrixPtr()->linftyNorm();\r\n    a.matrixPtr()->printMatlab(str);\r\n  }\r\n  void doStuff(mpl::bool_<true>)\r\n  {\r\n    range_type range;\r\n    sum s(Xh);\r\n    boost::fusion::for_each(range,s);\r\n    norm1=s.norm1();\r\n    normInf=s.normInf();\r\n    s.save(str);\r\n  }\r\n  struct sum\r\n  {\r\n    sum(space_ptrtype toto){\r\n      Xh = toto; \r\n      a  = form2(Xh,Xh);\r\n    }\r\n\r\n    template<typename T>\r\n      void operator()(T const& t) const{\r\n        auto lXh = Xh->template functionSpace<T::value>();\r\n        auto u = lXh->element();\r\n        a += integrate(_range=elements(Xh->mesh()), _expr=inner(id(u),idt(u)));\r\n      }\r\n\r\n    double norm1(void){\r\n      return a.matrixPtr()->l1Norm();\r\n    }\r\n    double normInf(void){\r\n      return a.matrixPtr()->linftyNorm();\r\n    }\r\n    void save(std::string s)\r\n    {\r\n    a.matrixPtr()->printMatlab(s);\r\n    }\r\n    space_ptrtype Xh;\r\n    mutable form2_type a;\r\n  };\r\n\r\n  space_ptrtype Xh;\r\n  std::string str;\r\n  typedef typename mpl::range_c<int, 0, space_ptrtype::element_type::nSpaces> range_type;\r\n  double norm1;\r\n  double normInf;\r\n};\r\nint main(int argc, char**argv )\r\n{\r\n  Environment \r\n    env( _argc=argc, _argv=argv,\r\n        _about=about(_name=\"spaces\",\r\n          _author=\"Feel++ Consortium\",\r\n          _email=\"feelpp-devel@feelpp.org\"));\r\n\r\n  typedef Mesh<Simplex<2>> mesh_type;\r\n  auto mesh = loadMesh(_mesh=new mesh_type);\r\n\r\n  /// Pch \r\n  auto Xh1 = Pch<1>(mesh);\r\n  getNorm<meta::Pch<mesh_type,1>::ptrtype> t1(Xh1,\"Xh\"); \r\n  std::cout << \"Pch = \"  << t1.n1() << \"\\t\" << t1.nI() << std::endl;\r\n\r\n  /// THch\r\n  auto Xh2 = THch<1>(mesh);\r\n  getNorm<meta::THch<1,mesh_type>::ptrtype> t2(Xh2,\"THch\"); \r\n  std::cout << \"THch = \"  << t2.n1() << \"\\t\" << t2.nI() << std::endl;\r\n  \r\n  /// Hcurl space\r\n  typedef Nedelec<0,NedelecKind::NED1 > curl_basis_type;\r\n  typedef FunctionSpace<mesh_type, bases<curl_basis_type>> curl_space_type;\r\n  typedef boost::shared_ptr<curl_space_type> curl_space_ptrtype;\r\n  auto Xh3 = curl_space_type::New(mesh);\r\n  getNorm<curl_space_ptrtype> t3(Xh3,\"Hcurl\");\r\n  std::cout << \"HCurl = \"  << t3.n1() << \"\\t\" << t3.nI() << std::endl;\r\n\r\n  /// HcurlxLag(v) spaces\r\n  typedef Lagrange<1,Scalar> lag_basis_type;\r\n  typedef Lagrange<1,Vectorial> lag_v_basis_type;\r\n  typedef FunctionSpace<mesh_type, bases<curl_basis_type,lag_basis_type>> comp_space_type;\r\n  typedef FunctionSpace<mesh_type, bases<curl_basis_type,lag_v_basis_type>> comp_v_space_type;\r\n  typedef boost::shared_ptr<comp_space_type> comp_space_ptrtype;\r\n  typedef boost::shared_ptr<comp_v_space_type> comp_v_space_ptrtype;\r\n  auto Xh4 = comp_space_type::New(mesh);\r\n  getNorm<comp_space_ptrtype> t4(Xh4,\"HcurlxLag\");\r\n  std::cout << \"HCurlxLag = \"  << t4.n1() << \"\\t\" << t4.nI() << std::endl;\r\n  auto Xh5 = comp_v_space_type::New(mesh);\r\n  getNorm<comp_v_space_ptrtype> t5(Xh5,\"HcurlxLagv\");\r\n  std::cout << \"HCurlxLagV = \"  << t5.n1() << \"\\t\" << t5.nI() << std::endl;\r\n\r\n  return 0;\r\n}\r\n```"}}