Hi, Libmesh Developers,

I want to get the values at any points of the mesh. I checked the
codes about how to calculate gradient in Meshfunction.c, as follows.
In order to the values at any points of the mesh, does it work to just
replace "dphi[i][0]" with "phi[i][0]"? Thanks a lot.
"
00336   // locate the point in the other mesh
00337   const Elem* element = this->_point_locator->operator()(p);
00338
00339   if(element==NULL)
00340     {
00341       output.resize(0);
00342     }
00343   else
00344     {
00345       // resize the output vector to the number of output values
00346       // that the user told us
00347       output.resize (this->_system_vars.size());
00348
00349
00350       {
00351         const unsigned int dim =
this->_eqn_systems.get_mesh().mesh_dimension();
00352
00353
00354         /*
00355          * Get local coordinates to feed these into compute_data().
00356          * Note that the fe_type can safely be used from the 0-variable,
00357          * since the inverse mapping is the same for all FEFamilies
00358          */
00359         const Point mapped_point (FEInterface::inverse_map (dim,
00360
this->_dof_map.variable_type(0),
00361                                                             element,
00362                                                             p));
00363
00364         std::vector<Point> point_list (1, mapped_point);
00365
00366         // loop over all vars
00367         for (unsigned int index=0; index <
this->_system_vars.size(); index++)
00368           {
00369             /*
00370              * the data for this variable
00371              */
00372             const unsigned int var = _system_vars[index];
00373             const FEType& fe_type = this->_dof_map.variable_type(var);
00374
00375             AutoPtr<FEBase> point_fe (FEBase::build(dim, fe_type));
00376             const std::vector<std::vector<RealGradient> >& dphi
= point_fe->get_dphi();
00377             point_fe->reinit(element, &point_list);
00378
00379             // where the solution values for the var-th variable
are stored
00380             std::vector<unsigned int> dof_indices;
00381             this->_dof_map.dof_indices (element, dof_indices, var);
00382
00383             // interpolate the solution
00384             Gradient grad(0.);
00385
00386             for (unsigned int i=0; i<dof_indices.size(); i++)
00387               grad.add_scaled(dphi[i][0], this->_vector(dof_indices[i]));
00388
00389             output[index] = grad;
00390           }
00391       }
00392     }
"

Regards,
Yujie

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to