{"action":"created","comment":{"url":"https://api.github.com/repos/flow123d/flow123d/pulls/comments/100492590","pull_request_review_id":21201157,"id":100492590,"diff_hunk":"@@ -290,11 +311,148 @@ void FieldFE<spacedim, Value>::value_list (const std::vector< Point >  &point_li\n \n \n template <int spacedim, class Value>\n+void FieldFE<spacedim, Value>::init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData& init_data) {\n+\tthis->init_unit_conversion_coefficient(rec, init_data);\n+\n+\n+\t// read mesh, create tree\n+    {\n+       source_mesh_ = new Mesh( Input::Record() );\n+       reader_file_ = FilePath( rec.val<FilePath>(\"gmsh_file\") );\n+       ReaderInstances::instance()->get_reader(reader_file_)->read_mesh( source_mesh_ );\n+\t   // no call to mesh->setup_topology, we need only elements, no connectivity\n+    }\n+\n+\tbih_tree_ = new BIHTree( source_mesh_ );\n+\n+\tfield_name_ = rec.val<std::string>(\"field_name\");\n+\n+\tmap1_ = new MappingP1<1,3>();\n+\tmap2_ = new MappingP1<2,3>();\n+\tmap3_ = new MappingP1<3,3>();\n+}\n+\n+\n+\n+template <int spacedim, class Value>\n+void FieldFE<spacedim, Value>::set_mesh(const Mesh *mesh, bool boundary_domain) {\n+\t// Mesh can't be set for field which is not initialized.\n+\tif (field_name_ == \"\") return;\n+\n+\tdh_ = new DOFHandlerMultiDim( const_cast<Mesh &>(*mesh) );\n+\tdh_->distribute_dofs(fe1, fe2, fe3);\n+    unsigned int ndofs = max(dh_->fe<1>()->n_dofs(), max(dh_->fe<2>()->n_dofs(), dh_->fe<3>()->n_dofs()));\n+    dof_indices = new unsigned int[ndofs];\n+    // allocate data_\n+\tunsigned int data_size = dh_->n_global_dofs();\n+\tVec v;\n+    std::vector<double> data_vec;\n+\tdata_vec.resize(data_size);\n+\tVecCreateSeqWithArray(PETSC_COMM_SELF, 1, data_size, &(data_vec[0]), &v);\n+    data_vec_ = &v;\n+    VecGetArray(*data_vec_, &data_);\n+}\n+\n+\n+\n+template <int spacedim, class Value>\n+bool FieldFE<spacedim, Value>::set_time(const TimeStep &time) {\n+\t// Time can't be set for field which is not initialized.\n+\tif (field_name_ == \"\") return false;\n+\n+\tASSERT_PTR(dh_)(field_name_).error(\"Null target mesh pointer of elementwise field, did you call set_mesh()?\\n\");\n+    if ( reader_file_ == FilePath() ) return false;\n+\n+    //walkaround for the steady time governor - there is no data to be read in time==infinity\n+    //TODO: is it possible to check this before calling set_time?\n+    //if (time == numeric_limits< double >::infinity()) return false;\n+\n+    // value of last computed element must be recalculated if time is changed\n+    computed_elm_idx_ = numeric_limits<unsigned int>::max();\n+\n+    GMSH_DataHeader search_header;\n+    search_header.actual = false;\n+    search_header.field_name = field_name_;\n+    search_header.n_components = this->value_.n_rows() * this->value_.n_cols();\n+    search_header.n_entities = source_mesh_->element.size();\n+    search_header.time = time.end();\n+\n+    bool boundary_domain_ = false;\n+    std::vector<double> data_vec = *(ReaderInstances::instance()->get_reader(reader_file_)->template get_element_data<double>(search_header,\n+    \t\tsource_mesh_->elements_id_maps(boundary_domain_), this->component_idx_));\n+    std::cout << std::endl;\n+    std::vector<double> sum_val(4);\n+    std::vector<unsigned int> elem_count(4);\n+\n+    FOR_ELEMENTS( dh_->mesh(), ele ) {\n+    \tsearched_elements_.clear();\n+    \t((BIHTree *)bih_tree_)->find_point(ele->centre(), searched_elements_);\n+    \tfound_point_.SetCoord( ele->centre()(0), ele->centre()(1), ele->centre()(2) );\n+    \tstd::fill(sum_val.begin(), sum_val.end(), 0.0);\n+    \tstd::fill(elem_count.begin(), elem_count.end(), 0);\n+    \tfor (std::vector<unsigned int>::iterator it = searched_elements_.begin(); it!=searched_elements_.end(); it++) {\n+    \t\tElementFullIter elm = source_mesh_->element( *it );\n+\t\t\tswitch (elm->dim()) {\n+\t\t\t\tcase 0: {","path":"src/fields/field_fe.cc","position":277,"original_position":155,"commit_id":"633b579afbfcbadf6aeb692b9aa323b59fc15f6d","original_commit_id":"c75c543a044e5944536ddada6c6e6a6cc10982ed","user":{"login":"jbrezmorf","id":326204,"avatar_url":"https://avatars.githubusercontent.com/u/326204?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrezmorf","html_url":"https://github.com/jbrezmorf","followers_url":"https://api.github.com/users/jbrezmorf/followers","following_url":"https://api.github.com/users/jbrezmorf/following{/other_user}","gists_url":"https://api.github.com/users/jbrezmorf/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrezmorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrezmorf/subscriptions","organizations_url":"https://api.github.com/users/jbrezmorf/orgs","repos_url":"https://api.github.com/users/jbrezmorf/repos","events_url":"https://api.github.com/users/jbrezmorf/events{/privacy}","received_events_url":"https://api.github.com/users/jbrezmorf/received_events","type":"User","site_admin":false},"body":"Use:\r\n\r\n\tmap =elm->get_map\r\n\tprojection = elm->project_point(found_point_, map)\r\n\tif (projection.min() >= -BoundingBox::epsilon) {\r\n\t\t// projection in element\r\n\t\tprojection_point = map.col(dim()) + map.cols(0, dim()-1) * projection.rows(0, dim()-1);\r\n\t\tif ( arma::norm(projection_point - found_point_, \"inf\") < 2*BoundingBox::epsilon ) {\r\n\t\t\t// point on the element\r\n\t\t}\r\n\t}","created_at":"2017-02-10T08:50:27Z","updated_at":"2017-02-10T08:50:27Z","html_url":"https://github.com/flow123d/flow123d/pull/811#discussion_r100492590","pull_request_url":"https://api.github.com/repos/flow123d/flow123d/pulls/811","_links":{"self":{"href":"https://api.github.com/repos/flow123d/flow123d/pulls/comments/100492590"},"html":{"href":"https://github.com/flow123d/flow123d/pull/811#discussion_r100492590"},"pull_request":{"href":"https://api.github.com/repos/flow123d/flow123d/pulls/811"}}},"pull_request":{"url":"https://api.github.com/repos/flow123d/flow123d/pulls/811","id":104769943,"html_url":"https://github.com/flow123d/flow123d/pull/811","diff_url":"https://github.com/flow123d/flow123d/pull/811.diff","patch_url":"https://github.com/flow123d/flow123d/pull/811.patch","issue_url":"https://api.github.com/repos/flow123d/flow123d/issues/811","number":811,"state":"open","locked":false,"title":"Df field interpolation","user":{"login":"jbrezmorf","id":326204,"avatar_url":"https://avatars.githubusercontent.com/u/326204?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrezmorf","html_url":"https://github.com/jbrezmorf","followers_url":"https://api.github.com/users/jbrezmorf/followers","following_url":"https://api.github.com/users/jbrezmorf/following{/other_user}","gists_url":"https://api.github.com/users/jbrezmorf/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrezmorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrezmorf/subscriptions","organizations_url":"https://api.github.com/users/jbrezmorf/orgs","repos_url":"https://api.github.com/users/jbrezmorf/repos","events_url":"https://api.github.com/users/jbrezmorf/events{/privacy}","received_events_url":"https://api.github.com/users/jbrezmorf/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-02-06T10:22:47Z","updated_at":"2017-02-10T08:50:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fc4eacdd552468713f6581902354a5e45d55b0c4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/flow123d/flow123d/pulls/811/commits","review_comments_url":"https://api.github.com/repos/flow123d/flow123d/pulls/811/comments","review_comment_url":"https://api.github.com/repos/flow123d/flow123d/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flow123d/flow123d/issues/811/comments","statuses_url":"https://api.github.com/repos/flow123d/flow123d/statuses/633b579afbfcbadf6aeb692b9aa323b59fc15f6d","head":{"label":"flow123d:DF_field_interpolation","ref":"DF_field_interpolation","sha":"633b579afbfcbadf6aeb692b9aa323b59fc15f6d","user":{"login":"flow123d","id":5418109,"avatar_url":"https://avatars.githubusercontent.com/u/5418109?v=3","gravatar_id":"","url":"https://api.github.com/users/flow123d","html_url":"https://github.com/flow123d","followers_url":"https://api.github.com/users/flow123d/followers","following_url":"https://api.github.com/users/flow123d/following{/other_user}","gists_url":"https://api.github.com/users/flow123d/gists{/gist_id}","starred_url":"https://api.github.com/users/flow123d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flow123d/subscriptions","organizations_url":"https://api.github.com/users/flow123d/orgs","repos_url":"https://api.github.com/users/flow123d/repos","events_url":"https://api.github.com/users/flow123d/events{/privacy}","received_events_url":"https://api.github.com/users/flow123d/received_events","type":"Organization","site_admin":false},"repo":{"id":13628170,"name":"flow123d","full_name":"flow123d/flow123d","owner":{"login":"flow123d","id":5418109,"avatar_url":"https://avatars.githubusercontent.com/u/5418109?v=3","gravatar_id":"","url":"https://api.github.com/users/flow123d","html_url":"https://github.com/flow123d","followers_url":"https://api.github.com/users/flow123d/followers","following_url":"https://api.github.com/users/flow123d/following{/other_user}","gists_url":"https://api.github.com/users/flow123d/gists{/gist_id}","starred_url":"https://api.github.com/users/flow123d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flow123d/subscriptions","organizations_url":"https://api.github.com/users/flow123d/orgs","repos_url":"https://api.github.com/users/flow123d/repos","events_url":"https://api.github.com/users/flow123d/events{/privacy}","received_events_url":"https://api.github.com/users/flow123d/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flow123d/flow123d","description":"Main repository of the Flow123d project.","fork":false,"url":"https://api.github.com/repos/flow123d/flow123d","forks_url":"https://api.github.com/repos/flow123d/flow123d/forks","keys_url":"https://api.github.com/repos/flow123d/flow123d/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flow123d/flow123d/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flow123d/flow123d/teams","hooks_url":"https://api.github.com/repos/flow123d/flow123d/hooks","issue_events_url":"https://api.github.com/repos/flow123d/flow123d/issues/events{/number}","events_url":"https://api.github.com/repos/flow123d/flow123d/events","assignees_url":"https://api.github.com/repos/flow123d/flow123d/assignees{/user}","branches_url":"https://api.github.com/repos/flow123d/flow123d/branches{/branch}","tags_url":"https://api.github.com/repos/flow123d/flow123d/tags","blobs_url":"https://api.github.com/repos/flow123d/flow123d/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flow123d/flow123d/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flow123d/flow123d/git/refs{/sha}","trees_url":"https://api.github.com/repos/flow123d/flow123d/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flow123d/flow123d/statuses/{sha}","languages_url":"https://api.github.com/repos/flow123d/flow123d/languages","stargazers_url":"https://api.github.com/repos/flow123d/flow123d/stargazers","contributors_url":"https://api.github.com/repos/flow123d/flow123d/contributors","subscribers_url":"https://api.github.com/repos/flow123d/flow123d/subscribers","subscription_url":"https://api.github.com/repos/flow123d/flow123d/subscription","commits_url":"https://api.github.com/repos/flow123d/flow123d/commits{/sha}","git_commits_url":"https://api.github.com/repos/flow123d/flow123d/git/commits{/sha}","comments_url":"https://api.github.com/repos/flow123d/flow123d/comments{/number}","issue_comment_url":"https://api.github.com/repos/flow123d/flow123d/issues/comments{/number}","contents_url":"https://api.github.com/repos/flow123d/flow123d/contents/{+path}","compare_url":"https://api.github.com/repos/flow123d/flow123d/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flow123d/flow123d/merges","archive_url":"https://api.github.com/repos/flow123d/flow123d/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flow123d/flow123d/downloads","issues_url":"https://api.github.com/repos/flow123d/flow123d/issues{/number}","pulls_url":"https://api.github.com/repos/flow123d/flow123d/pulls{/number}","milestones_url":"https://api.github.com/repos/flow123d/flow123d/milestones{/number}","notifications_url":"https://api.github.com/repos/flow123d/flow123d/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flow123d/flow123d/labels{/name}","releases_url":"https://api.github.com/repos/flow123d/flow123d/releases{/id}","deployments_url":"https://api.github.com/repos/flow123d/flow123d/deployments","created_at":"2013-10-16T18:56:28Z","updated_at":"2017-01-19T11:57:02Z","pushed_at":"2017-02-09T17:01:01Z","git_url":"git://github.com/flow123d/flow123d.git","ssh_url":"git@github.com:flow123d/flow123d.git","clone_url":"https://github.com/flow123d/flow123d.git","svn_url":"https://github.com/flow123d/flow123d","homepage":"<img> http://dev.nti.tul.cz:8080/job/Flow123d/badge/icon </img>","size":149410,"stargazers_count":10,"watchers_count":10,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":191,"forks":4,"open_issues":191,"watchers":10,"default_branch":"master"}},"base":{"label":"flow123d:master","ref":"master","sha":"420d5410e3cd1b162318a3032a7302631104ee35","user":{"login":"flow123d","id":5418109,"avatar_url":"https://avatars.githubusercontent.com/u/5418109?v=3","gravatar_id":"","url":"https://api.github.com/users/flow123d","html_url":"https://github.com/flow123d","followers_url":"https://api.github.com/users/flow123d/followers","following_url":"https://api.github.com/users/flow123d/following{/other_user}","gists_url":"https://api.github.com/users/flow123d/gists{/gist_id}","starred_url":"https://api.github.com/users/flow123d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flow123d/subscriptions","organizations_url":"https://api.github.com/users/flow123d/orgs","repos_url":"https://api.github.com/users/flow123d/repos","events_url":"https://api.github.com/users/flow123d/events{/privacy}","received_events_url":"https://api.github.com/users/flow123d/received_events","type":"Organization","site_admin":false},"repo":{"id":13628170,"name":"flow123d","full_name":"flow123d/flow123d","owner":{"login":"flow123d","id":5418109,"avatar_url":"https://avatars.githubusercontent.com/u/5418109?v=3","gravatar_id":"","url":"https://api.github.com/users/flow123d","html_url":"https://github.com/flow123d","followers_url":"https://api.github.com/users/flow123d/followers","following_url":"https://api.github.com/users/flow123d/following{/other_user}","gists_url":"https://api.github.com/users/flow123d/gists{/gist_id}","starred_url":"https://api.github.com/users/flow123d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flow123d/subscriptions","organizations_url":"https://api.github.com/users/flow123d/orgs","repos_url":"https://api.github.com/users/flow123d/repos","events_url":"https://api.github.com/users/flow123d/events{/privacy}","received_events_url":"https://api.github.com/users/flow123d/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flow123d/flow123d","description":"Main repository of the Flow123d project.","fork":false,"url":"https://api.github.com/repos/flow123d/flow123d","forks_url":"https://api.github.com/repos/flow123d/flow123d/forks","keys_url":"https://api.github.com/repos/flow123d/flow123d/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flow123d/flow123d/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flow123d/flow123d/teams","hooks_url":"https://api.github.com/repos/flow123d/flow123d/hooks","issue_events_url":"https://api.github.com/repos/flow123d/flow123d/issues/events{/number}","events_url":"https://api.github.com/repos/flow123d/flow123d/events","assignees_url":"https://api.github.com/repos/flow123d/flow123d/assignees{/user}","branches_url":"https://api.github.com/repos/flow123d/flow123d/branches{/branch}","tags_url":"https://api.github.com/repos/flow123d/flow123d/tags","blobs_url":"https://api.github.com/repos/flow123d/flow123d/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flow123d/flow123d/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flow123d/flow123d/git/refs{/sha}","trees_url":"https://api.github.com/repos/flow123d/flow123d/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flow123d/flow123d/statuses/{sha}","languages_url":"https://api.github.com/repos/flow123d/flow123d/languages","stargazers_url":"https://api.github.com/repos/flow123d/flow123d/stargazers","contributors_url":"https://api.github.com/repos/flow123d/flow123d/contributors","subscribers_url":"https://api.github.com/repos/flow123d/flow123d/subscribers","subscription_url":"https://api.github.com/repos/flow123d/flow123d/subscription","commits_url":"https://api.github.com/repos/flow123d/flow123d/commits{/sha}","git_commits_url":"https://api.github.com/repos/flow123d/flow123d/git/commits{/sha}","comments_url":"https://api.github.com/repos/flow123d/flow123d/comments{/number}","issue_comment_url":"https://api.github.com/repos/flow123d/flow123d/issues/comments{/number}","contents_url":"https://api.github.com/repos/flow123d/flow123d/contents/{+path}","compare_url":"https://api.github.com/repos/flow123d/flow123d/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flow123d/flow123d/merges","archive_url":"https://api.github.com/repos/flow123d/flow123d/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flow123d/flow123d/downloads","issues_url":"https://api.github.com/repos/flow123d/flow123d/issues{/number}","pulls_url":"https://api.github.com/repos/flow123d/flow123d/pulls{/number}","milestones_url":"https://api.github.com/repos/flow123d/flow123d/milestones{/number}","notifications_url":"https://api.github.com/repos/flow123d/flow123d/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flow123d/flow123d/labels{/name}","releases_url":"https://api.github.com/repos/flow123d/flow123d/releases{/id}","deployments_url":"https://api.github.com/repos/flow123d/flow123d/deployments","created_at":"2013-10-16T18:56:28Z","updated_at":"2017-01-19T11:57:02Z","pushed_at":"2017-02-09T17:01:01Z","git_url":"git://github.com/flow123d/flow123d.git","ssh_url":"git@github.com:flow123d/flow123d.git","clone_url":"https://github.com/flow123d/flow123d.git","svn_url":"https://github.com/flow123d/flow123d","homepage":"<img> http://dev.nti.tul.cz:8080/job/Flow123d/badge/icon </img>","size":149410,"stargazers_count":10,"watchers_count":10,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":191,"forks":4,"open_issues":191,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flow123d/flow123d/pulls/811"},"html":{"href":"https://github.com/flow123d/flow123d/pull/811"},"issue":{"href":"https://api.github.com/repos/flow123d/flow123d/issues/811"},"comments":{"href":"https://api.github.com/repos/flow123d/flow123d/issues/811/comments"},"review_comments":{"href":"https://api.github.com/repos/flow123d/flow123d/pulls/811/comments"},"review_comment":{"href":"https://api.github.com/repos/flow123d/flow123d/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flow123d/flow123d/pulls/811/commits"},"statuses":{"href":"https://api.github.com/repos/flow123d/flow123d/statuses/633b579afbfcbadf6aeb692b9aa323b59fc15f6d"}}}}
{"actor":{"display_login":"jbrezmorf"}}