From: John P. <jwp...@gm...> - 2018-05-15 14:24:06
|
On Tue, May 15, 2018 at 8:17 AM, Griffith, Boyce Eugene < bo...@em...> wrote: > > > On May 15, 2018, at 10:13 AM, John Peterson <jwp...@gm...> wrote: > > > > On Tue, May 15, 2018 at 5:37 AM, Griffith, Boyce Eugene < > bo...@em...> wrote: > >> Folks -- >> >> Is there an easy way in the library to get normal vectors on surface >> meshes (e.g. 2D elements in 3D space, 1D elements in 2D space, etc)? It >> seems like most of the support for this assumes that these are only needed >> for doing surface integrals on volumetric meshes, but I am sure I am >> overlooking something. >> > > The "simplest" way is to build an FE object and only pre-request the > normals by calling: > > const std::vector<Point> & face_normals = fe_face->get_normals(); > > > I may be making a blunder here, but this doesn't seem to work if the > dimension of the quadrature rule is equal to the dimension of the mesh --- > the normals do not appear to be computed. > Hmm... yes generally you would use a dim-1 dimensional quadrature rule in this context, e.g. the following (from adaptivity_ex4) should work: std::unique_ptr<FEBase> fe_face (FEBase::build(dim, fe_type)); std::unique_ptr<QBase> qface(fe_type.default_quadrature_rule(dim-1)); fe_face->attach_quadrature_rule (qface.get()); const std::vector<Point> & face_normals = fe_face->get_normals(); fe_face->reinit(elem, s); where "s" is the numerical index of a side. -- John |