On Wed, Jun 12, 2019 at 4:58 PM John Peterson <jwpeter...@gmail.com> wrote:

>
>
> On Wed, Jun 12, 2019 at 4:38 PM Nathan Andrew Miller <
> nathan.a.mil...@colorado.edu> 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

_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to