libMesh::MeshFunction Class Reference
#include <mesh_function.h>

Public Member Functions | |
| MeshFunction (const EquationSystems &eqn_systems, const NumericVector< Number > &vec, const DofMap &dof_map, const std::vector< unsigned int > &vars, const FunctionBase< Number > *master=NULL) | |
| MeshFunction (const EquationSystems &eqn_systems, const NumericVector< Number > &vec, const DofMap &dof_map, const unsigned int var, const FunctionBase< Number > *master=NULL) | |
| ~MeshFunction () | |
| void | init () |
| virtual void | init (const Trees::BuildType point_locator_build_type) |
| virtual void | clear () |
| virtual AutoPtr< FunctionBase < Number > > | clone () const |
| Number | operator() (const Point &p, const Real time=0.) |
| Gradient | gradient (const Point &p, const Real time=0.) |
| Tensor | hessian (const Point &p, const Real time=0.) |
| void | operator() (const Point &p, const Real time, DenseVector< Number > &output) |
| void | gradient (const Point &p, const Real time, std::vector< Gradient > &output) |
| void | hessian (const Point &p, const Real time, std::vector< Tensor > &output) |
| const PointLocatorBase & | get_point_locator (void) const |
| void | enable_out_of_mesh_mode (const DenseVector< Number > &value) |
| void | enable_out_of_mesh_mode (const Number &value) |
| void | disable_out_of_mesh_mode (void) |
| void | operator() (const Point &p, DenseVector< Number > &output) |
| virtual Number | component (unsigned int i, const Point &p, Real time=0.) |
| bool | initialized () const |
Protected Attributes | |
| const EquationSystems & | _eqn_systems |
| const NumericVector< Number > & | _vector |
| const DofMap & | _dof_map |
| const std::vector< unsigned int > | _system_vars |
| PointLocatorBase * | _point_locator |
| bool | _out_of_mesh_mode |
| DenseVector< Number > | _out_of_mesh_value |
| const FunctionBase * | _master |
| bool | _initialized |
Detailed Description
This class provides function-like objects for data distributed over a mesh.
Definition at line 56 of file mesh_function.h.
Constructor & Destructor Documentation
| libMesh::MeshFunction::MeshFunction | ( | const EquationSystems & | eqn_systems, | |
| const NumericVector< Number > & | vec, | |||
| const DofMap & | dof_map, | |||
| const std::vector< unsigned int > & | vars, | |||
| const FunctionBase< Number > * | master = NULL | |||
| ) |
Constructor for mesh based functions with vectors as return value. Optionally takes a master function. If the MeshFunction is to be evaluated outside of the local partition of the mesh, then both the mesh in eqn_systems and the coefficient vector vec should be serialized.
Definition at line 42 of file mesh_function.C.
Referenced by clone().
00046 : 00047 FunctionBase<Number> (master), 00048 _eqn_systems (eqn_systems), 00049 _vector (vec), 00050 _dof_map (dof_map), 00051 _system_vars (vars), 00052 _point_locator (NULL), 00053 _out_of_mesh_mode (false), 00054 _out_of_mesh_value () 00055 { 00056 }
| libMesh::MeshFunction::MeshFunction | ( | const EquationSystems & | eqn_systems, | |
| const NumericVector< Number > & | vec, | |||
| const DofMap & | dof_map, | |||
| const unsigned int | var, | |||
| const FunctionBase< Number > * | master = NULL | |||
| ) |
Constructor for mesh based functions with a number as return value. Optionally takes a master function. If the MeshFunction is to be evaluated outside of the local partition of the mesh, then both the mesh in eqn_systems and the coefficient vector vec should be serialized.
Definition at line 60 of file mesh_function.C.
00064 : 00065 FunctionBase<Number> (master), 00066 _eqn_systems (eqn_systems), 00067 _vector (vec), 00068 _dof_map (dof_map), 00069 _system_vars (1,var), 00070 _point_locator (NULL), 00071 _out_of_mesh_mode (false), 00072 _out_of_mesh_value () 00073 { 00074 // std::vector<unsigned int> buf (1); 00075 // buf[0] = var; 00076 // _system_vars (buf); 00077 }
| libMesh::MeshFunction::~MeshFunction | ( | ) |
Destructor.
Definition at line 85 of file mesh_function.C.
References libMesh::FunctionBase< Number >::_master, and _point_locator.
00086 { 00087 // only delete the point locator when we are the master 00088 if ((this->_point_locator != NULL) && (this->_master == NULL)) 00089 delete this->_point_locator; 00090 }
Member Function Documentation
| void libMesh::MeshFunction::clear | ( | ) | [virtual] |
Clears the function.
Reimplemented from libMesh::FunctionBase< Number >.
Definition at line 156 of file mesh_function.C.
References libMesh::FunctionBase< Number >::_initialized, libMesh::FunctionBase< Number >::_master, and _point_locator.
00157 { 00158 // only delete the point locator when we are the master 00159 if ((this->_point_locator != NULL) && (this->_master == NULL)) 00160 { 00161 delete this->_point_locator; 00162 this->_point_locator = NULL; 00163 } 00164 this->_initialized = false; 00165 }
| AutoPtr< FunctionBase< Number > > libMesh::MeshFunction::clone | ( | ) | const [virtual] |
Returns a new copy of the function. The new copy uses the original as a master function to enable simultaneous evaluations of the copies in different threads. Note that this implies the copy should not be used after the original is destroyed.
Implements libMesh::FunctionBase< Number >.
Definition at line 169 of file mesh_function.C.
References _dof_map, _eqn_systems, _system_vars, _vector, and MeshFunction().
00170 { 00171 return AutoPtr<FunctionBase<Number> > 00172 (new MeshFunction 00173 (_eqn_systems, _vector, _dof_map, _system_vars, this)); 00174 }
| virtual Number libMesh::FunctionBase< Number >::component | ( | unsigned int | i, | |
| const Point & | p, | |||
| Real | time = 0. | |||
| ) | [virtual, inherited] |
- Returns:
- the vector component
iat coordinatepand timetime. Subclasses aren't required to overload this, since the default implementation is based on the full vector evaluation, which is often correct. Subclasses are recommended to overload this, since the default implementation is based on a vector evaluation, which is usually unnecessarily inefficient.
| void libMesh::MeshFunction::disable_out_of_mesh_mode | ( | void | ) |
Disables out-of-mesh mode. This is also the default.
Definition at line 587 of file mesh_function.C.
References _out_of_mesh_mode, _point_locator, libMesh::PointLocatorBase::disable_out_of_mesh_mode(), and libMesh::FunctionBase< Number >::initialized().
00588 { 00589 libmesh_assert (this->initialized()); 00590 _point_locator->disable_out_of_mesh_mode(); 00591 _out_of_mesh_mode = false; 00592 }
| void libMesh::MeshFunction::enable_out_of_mesh_mode | ( | const Number & | value | ) |
Enables out-of-mesh mode. In this mode, if asked for a point that is not contained in any element, the MeshFunction will return the given value instead of crashing. This mode is off per default. If you use a master mesh function and you want to enable this mode, you will have to enable it for the master mesh function as well and for all mesh functions that have the same master mesh function. You may, however, specify different values.
Definition at line 580 of file mesh_function.C.
References enable_out_of_mesh_mode().
00581 { 00582 DenseVector<Number> v(1); 00583 v(0) = value; 00584 this->enable_out_of_mesh_mode(v); 00585 }
| void libMesh::MeshFunction::enable_out_of_mesh_mode | ( | const DenseVector< Number > & | value | ) |
Enables out-of-mesh mode. In this mode, if asked for a point that is not contained in any element, the MeshFunction will return the given value instead of crashing. This mode is off per default. If you use a master mesh function and you want to enable this mode, you will have to enable it for the master mesh function as well and for all mesh functions that have the same master mesh function. You may, however, specify different values.
Definition at line 572 of file mesh_function.C.
References _out_of_mesh_mode, _out_of_mesh_value, _point_locator, libMesh::PointLocatorBase::enable_out_of_mesh_mode(), and libMesh::FunctionBase< Number >::initialized().
Referenced by enable_out_of_mesh_mode().
00573 { 00574 libmesh_assert (this->initialized()); 00575 _point_locator->enable_out_of_mesh_mode(); 00576 _out_of_mesh_mode = true; 00577 _out_of_mesh_value = value; 00578 }
| const PointLocatorBase & libMesh::MeshFunction::get_point_locator | ( | void | ) | const |
Returns the current PointLocator object, for you might want to use it elsewhere. The MeshFunction object must be initialized before.
Definition at line 566 of file mesh_function.C.
References _point_locator, and libMesh::FunctionBase< Number >::initialized().
00567 { 00568 libmesh_assert (this->initialized()); 00569 return *_point_locator; 00570 }
| void libMesh::MeshFunction::gradient | ( | const Point & | p, | |
| const Real | time, | |||
| std::vector< Gradient > & | output | |||
| ) |
Computes gradients at coordinate p and for time time, which defaults to zero.
Definition at line 339 of file mesh_function.C.
References _dof_map, _eqn_systems, libMesh::FunctionBase< Number >::_master, _out_of_mesh_mode, _point_locator, _system_vars, _vector, libMesh::TypeVector< T >::add_scaled(), libMesh::FEGenericBase< Real >::build(), libMesh::DofMap::dof_indices(), end, libMesh::err, libMesh::Elem::find_point_neighbors(), libMesh::EquationSystems::get_mesh(), libMesh::FunctionBase< Number >::initialized(), libMesh::FEInterface::inverse_map(), libMesh::MeshBase::mesh_dimension(), libMesh::processor_id(), libMesh::DofObject::processor_id(), libMeshEnums::SERIAL, libMesh::NumericVector< T >::type(), and libMesh::DofMap::variable_type().
00342 { 00343 libmesh_assert (this->initialized()); 00344 00345 /* Ensure that in the case of a master mesh function, the 00346 out-of-mesh mode is enabled either for both or for none. This is 00347 important because the out-of-mesh mode is also communicated to 00348 the point locator. Since this is time consuming, enable it only 00349 in debug mode. */ 00350 #ifdef DEBUG 00351 if (this->_master != NULL) 00352 { 00353 const MeshFunction* master = 00354 libmesh_cast_ptr<const MeshFunction*>(this->_master); 00355 if(_out_of_mesh_mode!=master->_out_of_mesh_mode) 00356 { 00357 libMesh::err << "ERROR: If you use out-of-mesh-mode in connection with master mesh functions, you must enable out-of-mesh mode for both the master and the slave mesh function." << std::endl; 00358 libmesh_error(); 00359 } 00360 } 00361 #endif 00362 00363 // locate the point in the other mesh 00364 const Elem* element = this->_point_locator->operator()(p); 00365 00366 // If we have an element, but it's not a local element, then we 00367 // either need to have a serialized vector or we need to find a 00368 // local element sharing the same point. 00369 if (element && 00370 (element->processor_id() != libMesh::processor_id()) && 00371 _vector.type() != SERIAL) 00372 { 00373 // look for a local element containing the point 00374 std::set<const Elem*> point_neighbors; 00375 element->find_point_neighbors(p, point_neighbors); 00376 element = NULL; 00377 std::set<const Elem*>::const_iterator it = point_neighbors.begin(); 00378 const std::set<const Elem*>::const_iterator end = point_neighbors.end(); 00379 for (; it != end; ++it) 00380 { 00381 const Elem* elem = *it; 00382 if (elem->processor_id() == libMesh::processor_id()) 00383 { 00384 element = elem; 00385 break; 00386 } 00387 } 00388 } 00389 00390 if (!element) 00391 { 00392 output.resize(0); 00393 } 00394 else 00395 { 00396 // resize the output vector to the number of output values 00397 // that the user told us 00398 output.resize (this->_system_vars.size()); 00399 00400 00401 { 00402 const unsigned int dim = this->_eqn_systems.get_mesh().mesh_dimension(); 00403 00404 00405 /* 00406 * Get local coordinates to feed these into compute_data(). 00407 * Note that the fe_type can safely be used from the 0-variable, 00408 * since the inverse mapping is the same for all FEFamilies 00409 */ 00410 const Point mapped_point (FEInterface::inverse_map (dim, 00411 this->_dof_map.variable_type(0), 00412 element, 00413 p)); 00414 00415 std::vector<Point> point_list (1, mapped_point); 00416 00417 // loop over all vars 00418 for (unsigned int index=0; index < this->_system_vars.size(); index++) 00419 { 00420 /* 00421 * the data for this variable 00422 */ 00423 const unsigned int var = _system_vars[index]; 00424 const FEType& fe_type = this->_dof_map.variable_type(var); 00425 00426 AutoPtr<FEBase> point_fe (FEBase::build(dim, fe_type)); 00427 const std::vector<std::vector<RealGradient> >& dphi = point_fe->get_dphi(); 00428 point_fe->reinit(element, &point_list); 00429 00430 // where the solution values for the var-th variable are stored 00431 std::vector<dof_id_type> dof_indices; 00432 this->_dof_map.dof_indices (element, dof_indices, var); 00433 00434 // interpolate the solution 00435 Gradient grad(0.); 00436 00437 for (unsigned int i=0; i<dof_indices.size(); i++) 00438 grad.add_scaled(dphi[i][0], this->_vector(dof_indices[i])); 00439 00440 output[index] = grad; 00441 } 00442 } 00443 } 00444 00445 // all done 00446 return; 00447 }
- Returns:
- the first derivatives of variable 0 at point
pand fortime, which defaults to zero.
Definition at line 190 of file mesh_function.C.
References libMesh::FunctionBase< Number >::initialized().
Referenced by libMesh::ExactErrorEstimator::find_squared_element_error().
00192 { 00193 libmesh_assert (this->initialized()); 00194 00195 std::vector<Gradient> buf (1); 00196 this->gradient(p, time, buf); 00197 return buf[0]; 00198 }
| void libMesh::MeshFunction::hessian | ( | const Point & | p, | |
| const Real | time, | |||
| std::vector< Tensor > & | output | |||
| ) |
Computes gradients at coordinate p and for time time, which defaults to zero.
Definition at line 452 of file mesh_function.C.
References _dof_map, _eqn_systems, libMesh::FunctionBase< Number >::_master, _out_of_mesh_mode, _point_locator, _system_vars, _vector, libMesh::TypeTensor< T >::add_scaled(), libMesh::FEGenericBase< Real >::build(), libMesh::DofMap::dof_indices(), end, libMesh::err, libMesh::Elem::find_point_neighbors(), libMesh::EquationSystems::get_mesh(), libMesh::FunctionBase< Number >::initialized(), libMesh::FEInterface::inverse_map(), libMesh::MeshBase::mesh_dimension(), libMesh::processor_id(), libMesh::DofObject::processor_id(), libMeshEnums::SERIAL, libMesh::NumericVector< T >::type(), and libMesh::DofMap::variable_type().
00455 { 00456 libmesh_assert (this->initialized()); 00457 00458 /* Ensure that in the case of a master mesh function, the 00459 out-of-mesh mode is enabled either for both or for none. This is 00460 important because the out-of-mesh mode is also communicated to 00461 the point locator. Since this is time consuming, enable it only 00462 in debug mode. */ 00463 #ifdef DEBUG 00464 if (this->_master != NULL) 00465 { 00466 const MeshFunction* master = 00467 libmesh_cast_ptr<const MeshFunction*>(this->_master); 00468 if(_out_of_mesh_mode!=master->_out_of_mesh_mode) 00469 { 00470 libMesh::err << "ERROR: If you use out-of-mesh-mode in connection with master mesh functions, you must enable out-of-mesh mode for both the master and the slave mesh function." << std::endl; 00471 libmesh_error(); 00472 } 00473 } 00474 #endif 00475 00476 // locate the point in the other mesh 00477 const Elem* element = this->_point_locator->operator()(p); 00478 00479 // If we have an element, but it's not a local element, then we 00480 // either need to have a serialized vector or we need to find a 00481 // local element sharing the same point. 00482 if (element && 00483 (element->processor_id() != libMesh::processor_id()) && 00484 _vector.type() != SERIAL) 00485 { 00486 // look for a local element containing the point 00487 std::set<const Elem*> point_neighbors; 00488 element->find_point_neighbors(p, point_neighbors); 00489 element = NULL; 00490 std::set<const Elem*>::const_iterator it = point_neighbors.begin(); 00491 const std::set<const Elem*>::const_iterator end = point_neighbors.end(); 00492 for (; it != end; ++it) 00493 { 00494 const Elem* elem = *it; 00495 if (elem->processor_id() == libMesh::processor_id()) 00496 { 00497 element = elem; 00498 break; 00499 } 00500 } 00501 } 00502 00503 if (!element) 00504 { 00505 output.resize(0); 00506 } 00507 else 00508 { 00509 // resize the output vector to the number of output values 00510 // that the user told us 00511 output.resize (this->_system_vars.size()); 00512 00513 00514 { 00515 const unsigned int dim = this->_eqn_systems.get_mesh().mesh_dimension(); 00516 00517 00518 /* 00519 * Get local coordinates to feed these into compute_data(). 00520 * Note that the fe_type can safely be used from the 0-variable, 00521 * since the inverse mapping is the same for all FEFamilies 00522 */ 00523 const Point mapped_point (FEInterface::inverse_map (dim, 00524 this->_dof_map.variable_type(0), 00525 element, 00526 p)); 00527 00528 std::vector<Point> point_list (1, mapped_point); 00529 00530 // loop over all vars 00531 for (unsigned int index=0; index < this->_system_vars.size(); index++) 00532 { 00533 /* 00534 * the data for this variable 00535 */ 00536 const unsigned int var = _system_vars[index]; 00537 const FEType& fe_type = this->_dof_map.variable_type(var); 00538 00539 AutoPtr<FEBase> point_fe (FEBase::build(dim, fe_type)); 00540 const std::vector<std::vector<RealTensor> >& d2phi = 00541 point_fe->get_d2phi(); 00542 point_fe->reinit(element, &point_list); 00543 00544 // where the solution values for the var-th variable are stored 00545 std::vector<dof_id_type> dof_indices; 00546 this->_dof_map.dof_indices (element, dof_indices, var); 00547 00548 // interpolate the solution 00549 Tensor hess; 00550 00551 for (unsigned int i=0; i<dof_indices.size(); i++) 00552 hess.add_scaled(d2phi[i][0], this->_vector(dof_indices[i])); 00553 00554 output[index] = hess; 00555 } 00556 } 00557 } 00558 00559 // all done 00560 return; 00561 }
- Returns:
- the second derivatives of variable 0 at point
pand fortime, which defaults to zero.
Definition at line 203 of file mesh_function.C.
References libMesh::FunctionBase< Number >::initialized().
Referenced by libMesh::ExactErrorEstimator::find_squared_element_error().
00205 { 00206 libmesh_assert (this->initialized()); 00207 00208 std::vector<Tensor> buf (1); 00209 this->hessian(p, time, buf); 00210 return buf[0]; 00211 }
| void libMesh::MeshFunction::init | ( | const Trees::BuildType | point_locator_build_type | ) | [virtual] |
The actual initialization process. Takes an optional argument which specifies the method to use when building a PointLocator
Definition at line 95 of file mesh_function.C.
References _eqn_systems, libMesh::FunctionBase< Number >::_initialized, libMesh::FunctionBase< Number >::_master, _point_locator, _system_vars, libMesh::err, libMesh::EquationSystems::get_mesh(), mesh, libMesh::AutoPtr< Tp >::release(), and libMesh::MeshBase::sub_point_locator().
00096 { 00097 // are indices of the desired variable(s) provided? 00098 libmesh_assert_greater (this->_system_vars.size(), 0); 00099 00100 // Don't do twice... 00101 if (this->_initialized) 00102 { 00103 libmesh_assert(this->_point_locator); 00104 return; 00105 } 00106 00107 /* 00108 * set up the PointLocator: either someone else 00109 * is the master (go and get the address of his 00110 * point locator) or this object is the master 00111 * (build the point locator on our own). 00112 */ 00113 if (this->_master != NULL) 00114 { 00115 // we aren't the master 00116 const MeshFunction* master = 00117 libmesh_cast_ptr<const MeshFunction*>(this->_master); 00118 00119 if (master->_point_locator == NULL) 00120 { 00121 libMesh::err << "ERROR: When the master-servant concept is used," 00122 << std::endl 00123 << " the master has to be initialized first!" 00124 << std::endl; 00125 libmesh_error(); 00126 } 00127 else 00128 { 00129 this->_point_locator = master->_point_locator; 00130 } 00131 } 00132 else 00133 { 00134 // we are the master: build the point locator 00135 00136 // constant reference to the other mesh 00137 const MeshBase& mesh = this->_eqn_systems.get_mesh(); 00138 00139 // build the point locator. Only \p TREE version available 00140 //AutoPtr<PointLocatorBase> ap (PointLocatorBase::build (TREE, mesh)); 00141 //this->_point_locator = ap.release(); 00142 // this->_point_locator = new PointLocatorTree (mesh, point_locator_build_type); 00143 this->_point_locator = mesh.sub_point_locator().release(); 00144 00145 // Point locator no longer needs to be initialized. 00146 // this->_point_locator->init(); 00147 } 00148 00149 00150 // ready for use 00151 this->_initialized = true; 00152 }
| void libMesh::MeshFunction::init | ( | ) | [inline, virtual] |
The actual initialization process. specifies the method to use when building a PointLocator
Reimplemented from libMesh::FunctionBase< Number >.
Definition at line 99 of file mesh_function.h.
References init(), and libMesh::Trees::NODES.
Referenced by init().
00099 { this->init(Trees::NODES); };
| bool libMesh::FunctionBase< Number >::initialized | ( | ) | const [inherited] |
- Returns:
truewhen this object is properly initialized and ready for use,falseotherwise.
Referenced by disable_out_of_mesh_mode(), enable_out_of_mesh_mode(), get_point_locator(), gradient(), hessian(), and operator()().
| void libMesh::FunctionBase< Number >::operator() | ( | const Point & | p, | |
| DenseVector< Number > & | output | |||
| ) | [inherited] |
Return function for vectors. Returns in output the values of the data at the coordinate p.
| void libMesh::MeshFunction::operator() | ( | const Point & | p, | |
| const Real | time, | |||
| DenseVector< Number > & | output | |||
| ) | [virtual] |
Computes values at coordinate p and for time time, which defaults to zero.
Build an FEComputeData that contains both input and output data for the specific compute_data method.
Implements libMesh::FunctionBase< Number >.
Definition at line 216 of file mesh_function.C.
References _dof_map, _eqn_systems, libMesh::FunctionBase< Number >::_master, _out_of_mesh_mode, _out_of_mesh_value, _point_locator, _system_vars, _vector, libMesh::FEInterface::compute_data(), data, libMesh::DofMap::dof_indices(), end, libMesh::err, libMesh::Elem::find_point_neighbors(), libMesh::EquationSystems::get_mesh(), libMesh::FunctionBase< Number >::initialized(), libMesh::FEInterface::inverse_map(), libMesh::MeshBase::mesh_dimension(), libMesh::processor_id(), libMesh::DofObject::processor_id(), libMesh::DenseVector< T >::resize(), libMeshEnums::SERIAL, libMesh::FEComputeData::shape, libMesh::NumericVector< T >::type(), and libMesh::DofMap::variable_type().
00219 { 00220 libmesh_assert (this->initialized()); 00221 00222 /* Ensure that in the case of a master mesh function, the 00223 out-of-mesh mode is enabled either for both or for none. This is 00224 important because the out-of-mesh mode is also communicated to 00225 the point locator. Since this is time consuming, enable it only 00226 in debug mode. */ 00227 #ifdef DEBUG 00228 if (this->_master != NULL) 00229 { 00230 const MeshFunction* master = 00231 libmesh_cast_ptr<const MeshFunction*>(this->_master); 00232 if(_out_of_mesh_mode!=master->_out_of_mesh_mode) 00233 { 00234 libMesh::err << "ERROR: If you use out-of-mesh-mode in connection with master mesh functions, you must enable out-of-mesh mode for both the master and the slave mesh function." << std::endl; 00235 libmesh_error(); 00236 } 00237 } 00238 #endif 00239 00240 // locate the point in the other mesh 00241 const Elem* element = this->_point_locator->operator()(p); 00242 00243 // If we have an element, but it's not a local element, then we 00244 // either need to have a serialized vector or we need to find a 00245 // local element sharing the same point. 00246 if (element && 00247 (element->processor_id() != libMesh::processor_id()) && 00248 _vector.type() != SERIAL) 00249 { 00250 // look for a local element containing the point 00251 std::set<const Elem*> point_neighbors; 00252 element->find_point_neighbors(p, point_neighbors); 00253 element = NULL; 00254 std::set<const Elem*>::const_iterator it = point_neighbors.begin(); 00255 const std::set<const Elem*>::const_iterator end = point_neighbors.end(); 00256 for (; it != end; ++it) 00257 { 00258 const Elem* elem = *it; 00259 if (elem->processor_id() == libMesh::processor_id()) 00260 { 00261 element = elem; 00262 break; 00263 } 00264 } 00265 } 00266 00267 if (!element) 00268 { 00269 output = _out_of_mesh_value; 00270 } 00271 else 00272 { 00273 // resize the output vector to the number of output values 00274 // that the user told us 00275 output.resize (libmesh_cast_int<unsigned int> 00276 (this->_system_vars.size())); 00277 00278 00279 { 00280 const unsigned int dim = this->_eqn_systems.get_mesh().mesh_dimension(); 00281 00282 00283 /* 00284 * Get local coordinates to feed these into compute_data(). 00285 * Note that the fe_type can safely be used from the 0-variable, 00286 * since the inverse mapping is the same for all FEFamilies 00287 */ 00288 const Point mapped_point (FEInterface::inverse_map (dim, 00289 this->_dof_map.variable_type(0), 00290 element, 00291 p)); 00292 00293 00294 // loop over all vars 00295 for (unsigned int index=0; index < this->_system_vars.size(); index++) 00296 { 00297 /* 00298 * the data for this variable 00299 */ 00300 const unsigned int var = _system_vars[index]; 00301 const FEType& fe_type = this->_dof_map.variable_type(var); 00302 00307 { 00308 FEComputeData data (this->_eqn_systems, mapped_point); 00309 00310 FEInterface::compute_data (dim, fe_type, element, data); 00311 00312 // where the solution values for the var-th variable are stored 00313 std::vector<dof_id_type> dof_indices; 00314 this->_dof_map.dof_indices (element, dof_indices, var); 00315 00316 // interpolate the solution 00317 { 00318 Number value = 0.; 00319 00320 for (unsigned int i=0; i<dof_indices.size(); i++) 00321 value += this->_vector(dof_indices[i]) * data.shape[i]; 00322 00323 output(index) = value; 00324 } 00325 00326 } 00327 00328 // next variable 00329 } 00330 } 00331 } 00332 00333 // all done 00334 return; 00335 }
- Returns:
- the value of variable 0 at point
pand fortime, which defaults to zero.
Implements libMesh::FunctionBase< Number >.
Definition at line 178 of file mesh_function.C.
References libMesh::FunctionBase< Number >::initialized().
00180 { 00181 libmesh_assert (this->initialized()); 00182 00183 DenseVector<Number> buf (1); 00184 this->operator() (p, time, buf); 00185 return buf(0); 00186 }
Member Data Documentation
const DofMap& libMesh::MeshFunction::_dof_map [protected] |
Need access to the DofMap of the other system.
Definition at line 223 of file mesh_function.h.
Referenced by clone(), gradient(), hessian(), and operator()().
const EquationSystems& libMesh::MeshFunction::_eqn_systems [protected] |
The equation systems handler, from which the data are gathered.
Definition at line 212 of file mesh_function.h.
Referenced by clone(), gradient(), hessian(), init(), and operator()().
bool libMesh::FunctionBase< Number >::_initialized [protected, inherited] |
When init() was called so that everything is ready for calls to operator() (...), then this bool is true.
Definition at line 166 of file function_base.h.
const FunctionBase* libMesh::FunctionBase< Number >::_master [protected, inherited] |
Const pointer to our master, initialized to NULL. There may be cases where multiple functions are required, but to save memory, one master handles some centralized data.
Definition at line 160 of file function_base.h.
Referenced by clear(), gradient(), hessian(), init(), operator()(), and ~MeshFunction().
bool libMesh::MeshFunction::_out_of_mesh_mode [protected] |
true if out-of-mesh mode is enabled. See enable_out_of_mesh_mode() for more details. Default is false.
Definition at line 241 of file mesh_function.h.
Referenced by disable_out_of_mesh_mode(), enable_out_of_mesh_mode(), gradient(), hessian(), and operator()().
DenseVector<Number> libMesh::MeshFunction::_out_of_mesh_value [protected] |
Value to return outside the mesh if out-of-mesh mode is enabled. See enable_out_of_mesh_mode() for more details.
Definition at line 247 of file mesh_function.h.
Referenced by enable_out_of_mesh_mode(), and operator()().
PointLocatorBase* libMesh::MeshFunction::_point_locator [protected] |
A point locator is needed to locate the points in the mesh.
Definition at line 235 of file mesh_function.h.
Referenced by clear(), disable_out_of_mesh_mode(), enable_out_of_mesh_mode(), get_point_locator(), gradient(), hessian(), init(), operator()(), and ~MeshFunction().
const std::vector<unsigned int> libMesh::MeshFunction::_system_vars [protected] |
The indices of the variables within the other system for which data are to be gathered.
Definition at line 229 of file mesh_function.h.
Referenced by clone(), gradient(), hessian(), init(), and operator()().
const NumericVector<Number>& libMesh::MeshFunction::_vector [protected] |
A reference to the vector that holds the data that is to be interpolated.
Definition at line 218 of file mesh_function.h.
Referenced by clone(), gradient(), hessian(), and operator()().
The documentation for this class was generated from the following files:
Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:29 UTC
Hosted By: