From: John P. <jwp...@gm...> - 2019-06-12 22:00:32
|
On Wed, Jun 12, 2019 at 4:58 PM John Peterson <jwp...@gm...> wrote: > > > On Wed, Jun 12, 2019 at 4:38 PM Nathan Andrew Miller < > Nat...@co...> wrote: > >> I'm trying to compute the xyz, JxW, and other values at arbitrary points >> for a FEBase object during the evaluation of a MOOSE UserObject. I >> implemented the following in code: >> >> ``` >> //Create a vector of points >> std::vector< Point > cell_points; >> >> ...things to fill cell_points... >> >> //Create a vector of ones (the weights) >> ones = std::vector< double > (cell_points.size(), 1); >> >> std::unique_ptr< libMesh::FEBase > fe( >> libMesh::FEBase::build(_mesh.dimension(), >> libMesh::FEType(_current_elem->default_order()))); >> >> fe->reinit(_current_elem, &cell_points, &ones); >> >> > You have to pre-request that the xyz values be computed before you call > fe->reinit. So put the following line: > > >> std::vector< Point > xyz = fe->get_xyz(); >> > > before the reinit() call and it should work. > Oh, and be sure to get a *reference* std::vector< Point > & xyz = fe->get_xyz(); because it's going to be filled/changed as you reinit more elements later. In the code you posted you are making a copy... -- John |