#include <generic_projector.h>
|
| ProjectInteriors (GenericProjector &p) |
|
| ProjectInteriors (ProjectInteriors &p_i, Threads::split) |
|
void | operator() (const interior_range &range) |
|
void | insert_id (dof_id_type id, const FValue &val, processor_id_type pid) |
|
void | insert_ids (const std::vector< dof_id_type > &ids, const std::vector< FValue > &vals, processor_id_type pid) |
|
void | construct_projection (const std::vector< dof_id_type > &dof_indices_var, const std::vector< unsigned int > &involved_dofs, unsigned int var_component, const Node *node, const FEBase &fe) |
|
void | insert_id (dof_id_type id, const FValue &val, processor_id_type pid) |
|
void | insert_ids (const std::vector< dof_id_type > &ids, const std::vector< FValue > &vals, processor_id_type pid) |
|
void | find_dofs_to_send (const Node &node, const Elem &elem, unsigned short node_num, const var_set &vars) |
|
void | join (const SubFunctor &other) |
|
template<typename FFunctor, typename GFunctor, typename FValue, typename ProjectionAction>
struct libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectInteriors
Definition at line 329 of file generic_projector.h.
◆ ProjectInteriors() [1/2]
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ ProjectInteriors() [2/2]
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ construct_projection() [1/2]
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
void libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubProjector::construct_projection |
( |
const std::vector< dof_id_type > & |
dof_indices_var, |
|
|
const std::vector< unsigned int > & |
involved_dofs, |
|
|
unsigned int |
var_component, |
|
|
const Node * |
node, |
|
|
const FEBase & |
fe |
|
) |
| |
|
protectedinherited |
Definition at line 2501 of file generic_projector.h.
2507 const std::vector<Real> & JxW = fe.get_JxW();
2508 const std::vector<std::vector<Real>> & phi = fe.get_phi();
2509 const std::vector<std::vector<RealGradient>> * dphi =
nullptr;
2510 const std::vector<Point> & xyz_values = fe.get_xyz();
2512 const std::unordered_map<dof_id_type, FValue> &
ids_to_save =
2516 dphi = &(fe.get_dphi());
2518 const unsigned int n_involved_dofs =
2519 cast_int<unsigned int>(involved_dofs.size());
2521 std::vector<dof_id_type> free_dof_ids;
2522 DenseVector<FValue> Uinvolved(n_involved_dofs);
2523 std::vector<char> dof_is_fixed(n_involved_dofs,
false);
2525 for (
auto i : IntRange<unsigned int>(0, n_involved_dofs))
2527 const dof_id_type id = dof_indices_var[involved_dofs[i]];
2530 free_dof_ids.push_back(
id);
2533 dof_is_fixed[i] =
true;
2534 Uinvolved(i) = iter->second;
2538 const unsigned int free_dofs = free_dof_ids.size();
2548 DenseMatrix<Real> Ke(free_dofs, free_dofs);
2549 DenseVector<FValue> Fe(free_dofs);
2551 DenseVector<FValue> Ufree(free_dofs);
2553 const unsigned int n_qp =
2554 cast_int<unsigned int>(xyz_values.size());
2557 for (
unsigned int qp=0; qp<n_qp; qp++)
2560 FValue fineval =
f.eval_at_point(
context,
2565 VectorValue<FValue> finegrad;
2567 finegrad =
g->eval_at_point(
context,
2573 for (
unsigned int sidei=0, freei=0;
2574 sidei != n_involved_dofs; ++sidei)
2576 unsigned int i = involved_dofs[sidei];
2578 if (dof_is_fixed[sidei])
2580 for (
unsigned int sidej=0, freej=0;
2581 sidej != n_involved_dofs; ++sidej)
2583 unsigned int j = involved_dofs[sidej];
2584 if (dof_is_fixed[sidej])
2585 Fe(freei) -= phi[i][qp] * phi[j][qp] *
2586 JxW[qp] * Uinvolved(sidej);
2588 Ke(freei,freej) += phi[i][qp] *
2589 phi[j][qp] * JxW[qp];
2592 if (dof_is_fixed[sidej])
2593 Fe(freei) -= ( (*dphi)[i][qp] *
2595 JxW[qp] * Uinvolved(sidej);
2597 Ke(freei,freej) += ( (*dphi)[i][qp] *
2601 if (!dof_is_fixed[sidej])
2604 Fe(freei) += phi[i][qp] * fineval * JxW[qp];
2606 Fe(freei) += (finegrad * (*dphi)[i][qp] ) *
2612 Ke.cholesky_solve(Fe, Ufree);
2617 insert_ids(free_dof_ids, Ufree.get_values(), pid);
References libMesh::C_ONE, libMesh::DenseMatrix< T >::cholesky_solve(), libMesh::FEAbstract::get_continuity(), libMesh::FEGenericBase< OutputType >::get_dphi(), libMesh::FEAbstract::get_JxW(), libMesh::FEGenericBase< OutputType >::get_phi(), libMesh::DenseVector< T >::get_values(), libMesh::FEAbstract::get_xyz(), libMesh::DofObject::invalid_processor_id, libMesh::DofObject::processor_id(), and libMesh::DenseVector< T >::size().
◆ construct_projection() [2/2]
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
Definition at line 2501 of file generic_projector.h.
2507 const std::vector<Real> & JxW = fe.get_JxW();
2508 const std::vector<std::vector<Real>> & phi = fe.get_phi();
2509 const std::vector<std::vector<RealGradient>> * dphi =
nullptr;
2510 const std::vector<Point> & xyz_values = fe.get_xyz();
2512 const std::unordered_map<dof_id_type, FValue> &
ids_to_save =
2516 dphi = &(fe.get_dphi());
2518 const unsigned int n_involved_dofs =
2519 cast_int<unsigned int>(involved_dofs.size());
2521 std::vector<dof_id_type> free_dof_ids;
2522 DenseVector<FValue> Uinvolved(n_involved_dofs);
2523 std::vector<char> dof_is_fixed(n_involved_dofs,
false);
2525 for (
auto i : IntRange<unsigned int>(0, n_involved_dofs))
2527 const dof_id_type id = dof_indices_var[involved_dofs[i]];
2530 free_dof_ids.push_back(
id);
2533 dof_is_fixed[i] =
true;
2534 Uinvolved(i) = iter->second;
2538 const unsigned int free_dofs = free_dof_ids.size();
2548 DenseMatrix<Real> Ke(free_dofs, free_dofs);
2549 DenseVector<FValue> Fe(free_dofs);
2551 DenseVector<FValue> Ufree(free_dofs);
2553 const unsigned int n_qp =
2554 cast_int<unsigned int>(xyz_values.size());
2557 for (
unsigned int qp=0; qp<n_qp; qp++)
2560 FValue fineval =
f.eval_at_point(
context,
2565 VectorValue<FValue> finegrad;
2567 finegrad =
g->eval_at_point(
context,
2573 for (
unsigned int sidei=0, freei=0;
2574 sidei != n_involved_dofs; ++sidei)
2576 unsigned int i = involved_dofs[sidei];
2578 if (dof_is_fixed[sidei])
2580 for (
unsigned int sidej=0, freej=0;
2581 sidej != n_involved_dofs; ++sidej)
2583 unsigned int j = involved_dofs[sidej];
2584 if (dof_is_fixed[sidej])
2585 Fe(freei) -= phi[i][qp] * phi[j][qp] *
2586 JxW[qp] * Uinvolved(sidej);
2588 Ke(freei,freej) += phi[i][qp] *
2589 phi[j][qp] * JxW[qp];
2592 if (dof_is_fixed[sidej])
2593 Fe(freei) -= ( (*dphi)[i][qp] *
2595 JxW[qp] * Uinvolved(sidej);
2597 Ke(freei,freej) += ( (*dphi)[i][qp] *
2601 if (!dof_is_fixed[sidej])
2604 Fe(freei) += phi[i][qp] * fineval * JxW[qp];
2606 Fe(freei) += (finegrad * (*dphi)[i][qp] ) *
2612 Ke.cholesky_solve(Fe, Ufree);
2617 insert_ids(free_dof_ids, Ufree.get_values(), pid);
◆ find_dofs_to_send()
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
Definition at line 2345 of file generic_projector.h.
2359 std::vector<dof_id_type> node_dof_ids, patch_dof_ids;
2360 for (
const auto & var : vars)
2364 if (!variable.active_on_subdomain(elem.subdomain_id()))
2367 dof_map.dof_indices(elem, node_num, node_dof_ids, var);
2370 node_dof_ids.end()));
2371 const std::vector<dof_id_type> & patch =
2373 for (
const auto & elem_id : patch)
2375 const Elem & patch_elem =
mesh.elem_ref(elem_id);
2376 if (!patch_elem.active() || owner != patch_elem.processor_id())
2378 dof_map.dof_indices(&patch_elem, patch_dof_ids);
2379 std::sort(patch_dof_ids.begin(), patch_dof_ids.end());
2383 std::vector<dof_id_type> diff_ids(node_dof_ids.size());
2384 auto it = std::set_difference(node_dof_ids.begin(), node_dof_ids.end(),
2385 patch_dof_ids.begin(), patch_dof_ids.end(), diff_ids.begin());
2386 diff_ids.resize(it-diff_ids.begin());
2387 node_dof_ids.swap(diff_ids);
2388 if (node_dof_ids.empty())
2393 for (
auto id : node_dof_ids)
References libMesh::Elem::active(), libMesh::Variable::active_on_subdomain(), libMesh::DofMap::dof_indices(), libMesh::MeshBase::elem_ref(), libMesh::DofObject::id(), libMesh::DofObject::invalid_processor_id, libMesh::Parallel::Utils::is_sorted(), libMesh::libmesh_assert(), mesh, libMesh::Elem::node_ptr(), libMesh::DofObject::processor_id(), and libMesh::Elem::subdomain_id().
◆ insert_id() [1/2]
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ insert_id() [2/2]
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ insert_ids() [1/2]
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ insert_ids() [2/2]
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
Definition at line 1138 of file generic_projector.h.
1140 libmesh_assert_equal_to(ids.size(), vals.size());
1144 const FValue & val = vals[i];
1152 iter->second = std::make_pair(val, pid);
◆ join()
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ operator()()
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
Definition at line 2222 of file generic_projector.h.
2224 LOG_SCOPE (
"project_interiors",
"GenericProjector");
2229 for (
const auto & elem : range)
2231 unsigned char dim = cast_int<unsigned char>(elem->dim());
2241 if (!variable.active_on_subdomain(elem->subdomain_id()))
2244 const FEType & base_fe_type = variable.
type();
2246 if (base_fe_type.family ==
SCALAR)
2252 FEType fe_type = base_fe_type;
2258 const unsigned int var_component =
2266 if (fe_type.order > 1)
2268 const unsigned int first_interior_node =
2269 (elem->n_vertices() +
2270 ((elem->dim() > 2) * elem->n_edges()) +
2271 ((elem->dim() > 1) * elem->n_sides()));
2272 const unsigned int n_nodes = elem->n_nodes();
2275 for (
unsigned int n = first_interior_node; n <
n_nodes; ++n)
2277 const Node & interior_node = elem->node_ref(n);
2279 interior_node.dof_number(sys_num, var, 0);
2281 interior_node.processor_id();
2282 FValue fval =
f.eval_at_point
2290 #ifdef LIBMESH_ENABLE_AMR
2293 std::vector<Point> fine_points;
2295 std::unique_ptr<FEBase> fine_fe
2298 std::unique_ptr<QBase> qrule
2299 (base_fe_type.default_quadrature_rule(
dim));
2300 fine_fe->attach_quadrature_rule(qrule.get());
2302 const std::vector<Point> & child_xyz =
2305 for (
auto & child : elem->child_ref_range())
2307 fine_fe->reinit(&child);
2308 fine_points.insert(fine_points.end(),
2313 std::vector<Point> fine_qp;
2319 #endif // LIBMESH_ENABLE_AMR
2322 const std::vector<dof_id_type> & dof_indices =
2325 const unsigned int n_dofs =
2326 cast_int<unsigned int>(dof_indices.size());
2328 std::vector<unsigned int> all_dofs(n_dofs);
2329 std::iota(all_dofs.begin(), all_dofs.end(), 0);
2332 (dof_indices, all_dofs, var_component,
References libMesh::Variable::active_on_subdomain(), libMesh::FEGenericBase< OutputType >::build(), libMesh::FEType::default_quadrature_rule(), dim, libMesh::DofObject::dof_number(), libMesh::FEType::family, libMesh::FEMap::inverse_map(), libMesh::Utility::iota(), libMesh::Elem::JUST_COARSENED, libMesh::LAGRANGE, n_nodes, libMesh::FEType::order, libMesh::DofObject::processor_id(), libMesh::SCALAR, and libMesh::Variable::type().
◆ action
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ context
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ conts
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ new_ids_to_push
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ new_ids_to_save
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ projector
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
◆ system
template<typename FFunctor , typename GFunctor , typename FValue , typename ProjectionAction >
The documentation for this struct was generated from the following file:
std::unordered_map< dof_id_type, FValue > new_ids_to_save
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
void insert_id(dof_id_type id, const FValue &val, processor_id_type pid)
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
unsigned int number() const
const FEType & type() const
std::unordered_map< dof_id_type, std::pair< FValue, processor_id_type > > new_ids_to_push
const Variable & variable(unsigned int var) const
Return a constant reference to Variable var.
SubProjector(GenericProjector &p)
bool is_sorted(const std::vector< KeyType > &v)
void insert_ids(const std::vector< dof_id_type > &ids, const std::vector< FValue > &vals, processor_id_type pid)
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
void construct_projection(const std::vector< dof_id_type > &dof_indices_var, const std::vector< unsigned int > &involved_dofs, unsigned int var_component, const Node *node, const FEBase &fe)
unsigned int variable_scalar_number(const std::string &var, unsigned int component) const
FEGenericBase< Real > FEBase
void iota(ForwardIter first, ForwardIter last, T value)
Utility::iota is a duplication of the SGI STL extension std::iota.
const MeshBase & get_mesh() const
processor_id_type processor_id() const
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
uint8_t processor_id_type
std::unordered_map< dof_id_type, std::vector< dof_id_type > > * nodes_to_elem
const dof_id_type n_nodes
Real time
For time-dependent problems, this is the time t at the beginning of the current timestep.
virtual void elem_fe_reinit(const std::vector< Point > *const pts=nullptr)
Reinitializes interior FE objects on the current geometric element.
void get_element_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for interior finite element object for variable var for the largest dimension in the mesh.
static const processor_id_type invalid_processor_id
An invalid processor_id to distinguish DoFs that have not been assigned to a processor.
GenericProjector & projector
std::unordered_map< dof_id_type, FValue > ids_to_save
const DofMap & get_dof_map() const
const std::vector< unsigned int > & variables
std::unique_ptr< GFunctor > g