46 namespace Electromagnetism{
51 template <
typename TDomain,
typename TAlgebra>
58 : m_spEmMaterial (emMatherial),
59 m_spVertApproxSpace (vertApproxSpace),
65 m_potSolver (potSolver)
69 UG_THROW (
"NedelecProject: Object of the matherial properties not specified.");
71 UG_THROW (
"NedelecProject: Illegal vert.-centered approx. space.");
73 UG_THROW (
"NedelecProject: Exactly one function should be defined in the vert.-centered approx. space.");
75 UG_THROW (
"NedelecProject: The function in the vert.-centered approx. space must be defined everywhere.");
77 UG_THROW (
"NedelecProject: Illegal solver for the auxiliary problems.");
88 template <
typename TDomain,
typename TAlgebra>
97 UG_THROW (
"NedelecProject::apply: Specify a grid function, not a vector!");
101 apply (*u_ptr, fctGrp);
107 template <
typename TDomain,
typename TAlgebra>
111 const char * fct_names
120 UG_CATCH_THROW (
"NedelecProject: Functions '" << fct_names <<
"' not all contained in the edge approximation space.");
129 template <
typename TDomain,
typename TAlgebra>
137 if (! m_spEmMaterial->finalized ())
138 UG_THROW (
"NedelecProject: The material data structure has not been finalized.");
142 if (domain.
get () != m_spVertApproxSpace->domain().get ())
143 UG_THROW (
"NedelecProject: The approximation spaces are based on different domains.");
146 for (
size_t i_fct = 0; i_fct < fctGrp.
size (); i_fct++)
148 UG_THROW (
"NedelecProject: Not a Nedelec-element-based grid function specified for the projection.");
161 m_auxLaplaceOp->
init (aux_cor);
164 m_potSolver->init (m_auxLaplaceOp);
169 alloc_DVFs (* domain.
get (), aux_rhs);
170 compute_DVFs (aux_rhs);
171 compute_DVF_potential_coeffs (* domain.
get (), * vertDD.
get ());
175 for (
size_t i_fct = 0; i_fct < fctGrp.
size (); i_fct++)
176 project_func (domain, edgeDD, u, fctGrp[i_fct], vertDD, aux_rhs, aux_cor);
181 for (
size_t i = 0; i < m_DVF_phi.size (); i++)
182 delete m_DVF_phi [i];
183 m_DVF_phi.resize (0);
190 template <
typename TDomain,
typename TAlgebra>
194 const char * u_fct_name,
200 UG_THROW (
"NedelecProject: Illegal input grid function specification.");
203 if (sp_div.invalid ())
204 UG_THROW (
"NedelecProject: Illegal output grid function specification.");
207 if (! m_spEmMaterial->finalized ())
208 UG_THROW (
"The material data structure has not been finalized.");
212 if (domain.
get () != m_spVertApproxSpace->domain().get ())
213 UG_THROW (
"NedelecProject: The approximation spaces are based on different domains.");
221 UG_CATCH_THROW (
" Function '" << u_fct_name <<
"' not contained in the edge approximation space.");
224 UG_THROW (
"NedelecProject: Not a Nedelec-element-based input grid function.");
229 if (vertDD.
get () != m_spVertApproxSpace->dof_distribution(u.
grid_level ()).get ())
230 UG_THROW (
"NedelecProject: DoFDistribution mismatch, illegal output grid function.");
234 assemble_div (* domain.
get(), * edgeDD.
get(), u, u_fct, * vertDD.
get(), div, charge);
245 template <
typename TDomain,
typename TAlgebra>
268 assemble_div (* domain.
get(), * edgeDD.
get(), u, fct, * vertDD.
get(), aux_rhs, charge);
270 m_auxLaplaceRHS->set_base_conductor (-1);
271 m_auxLaplaceAss->adjust_solution (aux_rhs, vertDD);
273 m_auxLaplaceAss->adjust_solution (aux_cor, vertDD);
274 m_potSolver->apply (aux_cor, aux_rhs);
277 damp_DVFs (aux_cor, charge);
279 distribute_cor (* domain.
get(), * edgeDD.
get(), u, fct, * vertDD.
get(), aux_cor);
286 template <
typename TDomain,
typename TAlgebra>
287 template <
typename TElem>
290 const TDomain & domain,
302 const std::vector<int> & cond_index = m_spEmMaterial->base_conductor_index ();
306 std::vector<DoFIndex> vEdgeInd (ref_elem_type::numEdges);
307 std::vector<size_t> vVertInd (ref_elem_type::numCorners);
311 if (cond_index [si] == -1)
314 iterator e_end = vertDD.template end<TElem> (si);
315 for (iterator elem_iter = vertDD.template begin<TElem> (si);
316 elem_iter != e_end; ++elem_iter)
318 TElem * pElem = *elem_iter;
325 for (
size_t co = 0; co < (size_t) ref_elem_type::numCorners; co++)
326 aCorners [co] = aaPos [pElem->vertex (co)];
328 (
number (*) [ref_elem_type::numEdges]) & (B (0,0)));
331 if (edgeDD.
dof_indices (pElem, fct, vEdgeInd) != (
size_t) ref_elem_type::numEdges)
332 UG_THROW (
"NedelecProject: Edge DoF distribution mismatch. Not the Nedelec-Type-1 element?");
333 for (
size_t i = 0; i < (size_t) ref_elem_type::numEdges; i++)
334 loc_u [i] =
DoFRef (u, vEdgeInd [i]);
338 if (vertDD.
algebra_indices (pElem, vVertInd) != (
size_t) ref_elem_type::numCorners)
339 UG_THROW (
"NedelecProject: Vertex DoF distribution mismatch. Not the Lagrange-Order-1 element?");
340 for (
size_t i = 0; i < (size_t) ref_elem_type::numCorners; i++)
341 div [vVertInd [i]] += loc_div [i];
355 template <
typename TDomain,
typename TAlgebra>
356 template <
typename TElem>
367 const std::vector<int> & base_cond = m_spEmMaterial->base_conductors ();
368 if (base_cond.size () == 0)
return;
370 std::vector<size_t> vVertInd (ref_elem_type::numCorners);
371 const std::vector<int> & base_cond_index = m_spEmMaterial->base_conductor_index ();
376 if ((ci = base_cond_index [si]) >= 0)
378 number & charge_entry = charge [ci];
381 iterator e_end = vertDD.template end<TElem> (si);
382 for (iterator elem_iter = vertDD.template begin<TElem> (si);
383 elem_iter != e_end; ++elem_iter)
385 TElem * pElem = *elem_iter;
386 if (vertDD.
algebra_indices (pElem, vVertInd) != (
size_t) ref_elem_type::numCorners)
387 UG_THROW (
"NedelecProject: Vertex DoF distribution mismatch. Not the Lagrange-Order-1 element?");
388 for (
size_t i = 0; i < (size_t) ref_elem_type::numCorners; i++)
390 number & div_entry = div [vVertInd [i]];
391 charge_entry += div_entry;
402 template <
typename TDomain,
typename TAlgebra>
405 const TDomain & domain,
417 const std::vector<int> & base_cond = m_spEmMaterial->base_conductors ();
418 charge.resize (base_cond.size ());
419 if (charge.size () != 0)
428 boost::mpl::for_each<ElemList> (
WeakDiv (
this, domain, edgeDD, u, fct, vertDD, div));
434 if (charge.size () != 0)
438 sum.resize (charge.size ());
459 template <
typename TDomain,
typename TAlgebra>
462 const TDomain & domain,
475 UG_THROW (
"Consistent storage type is expected for the grid function to project.")
479 std::vector<size_t> vVertInd (1);
480 std::vector<DoFIndex> vEdgeInd (1);
483 t_edge_iterator iterEnd = edgeDD.
end<
Edge> ();
484 for (t_edge_iterator iter = edgeDD.
begin<
Edge> (); iter != iterEnd; iter++)
487 Edge * pEdge = *iter;
490 for (
size_t i = 0; i < 2; i++)
495 "More than one DoF per vertex for the auxiliary systems.");
498 corner_val [i] = cor [vVertInd[0]];
504 "More than one DoF per edge. Not the Nedelec-Type-1 element?");
506 -= corner_val [1] - corner_val [0];
514 template <
typename TDomain,
typename TAlgebra>
517 const TDomain & domain,
522 const std::vector<int> & cond_index = m_spEmMaterial->base_conductor_index ();
523 const std::vector<int> & base_cond = m_spEmMaterial->base_conductors ();
524 size_t n_cond = base_cond.size ();
525 std::vector<char> grounded (n_cond);
527 for (
size_t i = 0; i < n_cond; i++) grounded [i] = 0;
530 if (m_spDirichlet.valid ())
538 SubsetGroup dirichlet_ssgrp (domain.subset_handler());
539 m_spDirichlet->get_dirichlet_subsets (dirichlet_ssgrp);
542 for (
size_t j = 0; j < dirichlet_ssgrp.
size (); j++)
544 int si = dirichlet_ssgrp [j];
548 t_edge_iterator iterEnd = vertDD->
end<
Edge> (si);
549 for (t_edge_iterator iter = vertDD->
begin<
Edge> (si); iter != iterEnd; iter++)
552 ((
grid_type*)
grid)->associated_elements (volume_list, *iter);
553 for (
size_t v = 0; v < volume_list.
size (); v++)
556 if ((v_b_cnd = cond_index [ss_handler->get_subset_index (volume_list [v])]) < 0)
558 grounded [v_b_cnd] = 1;
567 std::vector<char> loc_grounded = grounded;
573 m_DVF_phi.resize (n_cond);
574 for (
size_t i = 0; i < n_cond; i++)
576 m_DVF_phi [i] = NULL;
584 template <
typename TDomain,
typename TAlgebra>
590 for (
size_t i = 0; i < m_DVF_phi.size (); i++)
593 if (phi == NULL)
continue;
596 m_auxLaplaceRHS->set_base_conductor (i);
608 m_potSolver->apply (*phi, aux_rhs);
615 template <
typename TDomain,
typename TAlgebra>
618 const TDomain & domain,
626 size_t num_b_cond = m_DVF_phi.size ();
627 m_potCoeff.resize (num_b_cond, num_b_cond,
false);
628 if (num_b_cond <= 0)
return;
633 sp_mg->attach_to_vertices (a_vert_base_cond);
637 boost::mpl::for_each<ElemList> (
MarkCondVert (
this, vertDD, vert_base_cond));
640 AttachmentAllReduce<Vertex> (*sp_mg, a_vert_base_cond,
PCL_RO_MAX);
647 (
this, domain, vertDD, vert_base_cond, m_potCoeff));
649 sp_mg->detach_from_vertices (a_vert_base_cond);
657 sum.resize (m_potCoeff.num_rows (), m_potCoeff.num_cols (),
false);
658 proc_comm.
allreduce (&(m_potCoeff.at(0,0)), &(sum.at(0,0)),
659 m_potCoeff.num_rows () * m_potCoeff.num_cols (),
PCL_RO_SUM);
664 for (
size_t i = 0; i < num_b_cond; i++)
665 if (m_DVF_phi [i] == NULL)
666 m_potCoeff (i, i) = 1;
668 for (
size_t j = i + 1; j < num_b_cond; j++)
669 m_potCoeff (i, j) = m_potCoeff (j, i);
678 template <
typename TDomain,
typename TAlgebra>
687 for (
size_t i = 0; i < m_DVF_phi.size (); i++)
688 if (m_DVF_phi [i] != NULL)
699 template <
typename TDomain,
typename TAlgebra>
700 template <
typename TElem>
713 const std::vector<int> & cond_index = m_spEmMaterial->base_conductor_index ();
716 std::vector<size_t> vVertInd (ref_elem_type::numCorners);
720 if ((base_cond_ind = cond_index [si]) >= 0)
723 if (m_DVF_phi [base_cond_ind] == NULL)
727 iterator e_end = vertDD.template end<TElem> (si);
728 for (iterator elem_iter = vertDD.template begin<TElem> (si);
729 elem_iter != e_end; ++elem_iter)
731 TElem * pElem = *elem_iter;
732 for (
size_t co = 0; co < (size_t) ref_elem_type::numCorners; co++)
733 vert_base_cond [pElem->vertex (co)] = base_cond_ind;
743 template <
typename TDomain,
typename TAlgebra>
744 template <
typename TElem>
747 const TDomain & domain,
760 const std::vector<int> & cond_index = m_spEmMaterial->base_conductor_index ();
763 std::vector<size_t> vVertInd (ref_elem_type::numCorners);
767 if (cond_index [si] == -2)
770 iterator e_end = vertDD.template end<TElem> (si);
771 for (iterator elem_iter = vertDD.template begin<TElem> (si);
772 elem_iter != e_end; ++elem_iter)
774 TElem * pElem = *elem_iter;
775 size_t corner_cond [ref_elem_type::numCorners];
779 cond_bnd_flag =
false;
780 for (
size_t co = 0; co < (size_t) ref_elem_type::numCorners; co++)
781 if ((corner_cond [co] = vert_base_cond [pElem->vertex (co)]) >= 0)
782 cond_bnd_flag =
true;
783 if (! cond_bnd_flag)
continue;
787 for (
size_t co = 0; co < (size_t) ref_elem_type::numCorners; co++)
788 aCorners [co] = aaPos [pElem->vertex (co)];
791 number loc_A [ref_elem_type::numCorners] [ref_elem_type::numCorners];
795 if (vertDD.
algebra_indices (pElem, vVertInd) != (
size_t) ref_elem_type::numCorners)
796 UG_THROW (
"NedelecProject: Vertex DoF distribution mismatch. Not the Lagrange-Order-1 element?");
797 for (
int to_cond = 0; to_cond < (int) m_DVF_phi.size (); to_cond++)
804 if (phi == NULL)
continue;
806 for (
size_t to_co = 0; to_co < (size_t) ref_elem_type::numCorners; to_co++)
809 number phi_val = (* phi) [vVertInd [to_co]];
810 for (
size_t from_co = 0; from_co < (size_t) ref_elem_type::numCorners; from_co++)
812 if ((from_cond = corner_cond [from_co]) >= to_cond)
813 C (from_cond, to_cond) += loc_A [from_co] [to_co] * phi_val;
825 template <
typename TDomain,
typename TAlgebra>
826 template <
typename TElem>
831 number loc_A [numCorners] [numCorners]
839 UG_ASSERT (geo.num_ip () == 1,
"Only the simplest quadrature is supported here.");
842 geo.update (elem, vCornerCoords);
845 for (
size_t from_co = 0; from_co < (size_t) numCorners; from_co++)
846 for (
size_t to_co = from_co; to_co < (size_t) numCorners; to_co++)
847 loc_A [from_co] [to_co]
848 =
VecDot (geo.global_grad (0, from_co), geo.global_grad (0, to_co))
851 for (
size_t from_co = 1; from_co < (size_t) numCorners; from_co++)
852 for (
size_t to_co = 0; to_co < from_co; to_co++)
853 loc_A [from_co] [to_co] = loc_A [to_co] [from_co];
860 template <
typename TDomain,
typename TAlgebra>
865 :
IElemDisc<TDomain> (master.m_spVertApproxSpace->name(0).c_str(), master.m_spEmMaterial->subset_names()),
866 m_master (master), m_do_assemble_here (false)
873 template<
typename TDomain,
typename TAlgebra>
876 const std::vector<LFEID> & vLfeID,
882 " The discretization of the auxiliary systems does not support hanging nodes.\n");
884 if (vLfeID.size () != 1)
886 " Only scalar grid functions are supported for the potential");
890 " Only Largange-1 functions are supported for the potential");
894 template<
typename TDomain,
typename TAlgebra>
905 template<
typename TDomain,
typename TAlgebra>
906 template<
typename TElem>
911 this->clear_add_fct(
id);
912 this->set_prep_elem_loop_fct(
id, & AuxLaplaceLocAss::template prepare_element_loop<TElem>);
913 this->set_prep_elem_fct (
id, & AuxLaplaceLocAss::template prepare_element<TElem>);
914 this->set_fsh_elem_loop_fct (
id, & AuxLaplaceLocAss::template finish_element_loop<TElem>);
915 this->set_add_jac_A_elem_fct(
id, & AuxLaplaceLocAss::template ass_JA_elem<TElem>);
916 this->set_add_jac_M_elem_fct(
id, & AuxLaplaceLocAss::template ass_JM_elem<TElem>);
917 this->set_add_def_A_elem_fct(
id, & AuxLaplaceLocAss::template ass_dA_elem<TElem>);
918 this->set_add_def_M_elem_fct(
id, & AuxLaplaceLocAss::template ass_dM_elem<TElem>);
919 this->set_add_rhs_elem_fct (
id, & AuxLaplaceLocAss::template ass_rhs_elem<TElem>);
923 template<
typename TDomain,
typename TAlgebra>
924 template<
typename TElem>
932 if (m_master.m_spEmMaterial->base_conductor_index (si) == -1)
933 m_do_assemble_here =
true;
935 m_do_assemble_here =
false;
939 template<
typename TDomain,
typename TAlgebra>
940 template<
typename TElem>
949 if (! m_do_assemble_here)
return;
954 number loc_A [ref_elem_type::numCorners] [ref_elem_type::numCorners];
958 for (
size_t from_co = 0; from_co < (size_t) ref_elem_type::numCorners; from_co++)
959 for (
size_t to_co = 0; to_co < (size_t) ref_elem_type::numCorners; to_co++)
960 J (_C_, from_co, _C_, to_co) += loc_A [from_co] [to_co];
968 template <
typename TDomain,
typename TAlgebra>
973 : m_master (master), m_base_cond (-2)
979 template <
typename TDomain,
typename TAlgebra>
986 if (m_master.m_spDirichlet.invalid ())
989 std::vector<size_t> vVertInd (1);
991 SubsetGroup dirichlet_ssgrp (m_master.m_spEmMaterial->subset_handler ());
992 m_master.m_spDirichlet->get_dirichlet_subsets (dirichlet_ssgrp);
995 for (
size_t j = 0; j < dirichlet_ssgrp.
size (); j++)
997 int si = dirichlet_ssgrp [j];
1003 Edge * pEdge = *iter;
1006 for(
size_t i = 0; i < 2; i++)
1011 "More than one DoF per vertex for the auxiliary systems.");
1014 u [vVertInd [0]] = 0;
1023 template <
typename TDomain,
typename TAlgebra>
1030 if (m_master.m_spDirichlet.invalid ())
1033 std::vector<size_t> vVertInd (1);
1035 SubsetGroup dirichlet_ssgrp (m_master.m_spEmMaterial->subset_handler ());
1036 m_master.m_spDirichlet->get_dirichlet_subsets (dirichlet_ssgrp);
1039 for (
size_t j = 0; j < dirichlet_ssgrp.
size (); j++)
1041 int si = dirichlet_ssgrp [j];
1047 Edge * pEdge = *iter;
1050 for(
size_t i = 0; i < 2; i++)
1055 "More than one DoF per vertex for the auxiliary systems.");
1067 template <
typename TDomain,
typename TAlgebra>
1068 template <
typename TElem>
1080 std::vector<size_t> vVertInd (1);
1083 t_elem_iterator iterEnd = dd->
end<TElem> (si);
1084 for (t_elem_iterator iter = dd->
begin<TElem> (si); iter != iterEnd; iter++)
1086 TElem * pElem = *iter;
1089 for(
size_t co = 0; co < (size_t) ref_elem_type::numCorners; co++)
1094 "More than one DoF per vertex for the auxiliary systems.");
1097 u [vVertInd [0]] = val;
1105 template <
typename TDomain,
typename TAlgebra>
1106 template <
typename TElem>
1117 std::vector<size_t> vVertInd (1);
1120 t_elem_iterator iterEnd = dd->
end<TElem> (si);
1121 for (t_elem_iterator iter = dd->
begin<TElem> (si); iter != iterEnd; iter++)
1123 TElem * pElem = *iter;
1126 for(
size_t co = 0; co < (size_t) ref_elem_type::numCorners; co++)
1131 "More than one DoF per vertex for the auxiliary systems.");
1142 template <
typename TDomain,
typename TAlgebra>
1155 set_identity_Dirichlet (J, dd.
get());
1159 const std::vector<int> & base_cond = m_master.m_spEmMaterial->base_conductor_index ();
1161 for (
size_t si = 0; si < base_cond.size (); si++)
1162 if (base_cond [si] >= 0)
1169 template <
typename TDomain,
typename TAlgebra>
1178 const std::vector<number> * vScaleMass,
1179 const std::vector<number> * vScaleStiff
1183 set_zero_Dirichlet (d, dd.
get ());
1187 const std::vector<int> & base_cond = m_master.m_spEmMaterial->base_conductor_index ();
1189 for (
size_t si = 0; si < base_cond.size (); si++)
1190 if (base_cond [si] >= 0)
1197 template <
typename TDomain,
typename TAlgebra>
1207 set_zero_Dirichlet (u, dd.
get ());
1211 const std::vector<int> & base_cond = m_master.m_spEmMaterial->base_conductor_index ();
1213 for (
size_t si = 0; si < base_cond.size (); si++)
1215 int the_base_cond = base_cond [si];
1216 if (the_base_cond < 0)
continue;
1217 number val = (the_base_cond == m_base_cond)? 1 : 0;
size_t allreduce(const size_t &t, pcl::ReduceOperation op) const
size_t dof_indices(GridObject *elem, size_t fct, std::vector< DoFIndex > &ind, bool bHang=false, bool bClear=true) const
size_t algebra_indices(GridObject *elem, std::vector< size_t > &ind, bool bClear=true) const
traits< TElem >::iterator begin()
size_t inner_algebra_indices(GridObject *elem, std::vector< size_t > &ind, bool bClear=true) const
size_t inner_dof_indices(GridObject *elem, size_t fct, std::vector< DoFIndex > &ind, bool bClear=true) const
traits< TElem >::iterator end()
SmartPtr< MultiGrid > multi_grid()
ConstSmartPtr< DoFDistributionInfo > dof_distribution_info() const
size_t fct_id_by_name(const char *name) const
FunctionGroup fct_grp_by_name(const char *names) const
const LFEID & local_finite_element_id(size_t fct) const
virtual Vertex * vertex(size_t index) const
Class for subdomain-dependent data for the E-based formulated problems.
Definition: em_material.h:63
Class for local assembling of the auxiliary Laplace operator.
Definition: nedelec_project.h:403
void prepare_element_loop(ReferenceObjectID roid, int si)
Definition: nedelec_project_impl.h:926
virtual void prepare_setting(const std::vector< LFEID > &vLfeID, bool bNonRegular)
switches between non-regular and regular grids
Definition: nedelec_project_impl.h:875
void register_loc_discr_func()
Definition: nedelec_project_impl.h:907
AuxLaplaceLocAss(NedelecProject &master)
constructor
Definition: nedelec_project_impl.h:862
void ass_JA_elem(LocalMatrix &J, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
transfer the local stiffness matrix to the global discretization
Definition: nedelec_project_impl.h:942
void register_all_loc_discr_funcs()
Definition: nedelec_project_impl.h:895
Constraint that assembles the rhs und the bc for the auxiliary problems.
Definition: nedelec_project.h:486
void adjust_defect(pot_vector_type &d, const pot_vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< pot_vector_type > > vSol=SPNULL, const std::vector< number > *vScaleMass=NULL, const std::vector< number > *vScaleStiff=NULL)
sets a zero value in the defect for all conductor indices
Definition: nedelec_project_impl.h:1171
void set_value_on_subset(int si, number val, pot_vector_type &u, const DoFDistribution *dd)
sets constant value on the closure of a full-dimensional subset
Definition: nedelec_project_impl.h:1070
void set_identity_Dirichlet(pot_matrix_type &A, const DoFDistribution *dd)
sets identity matrix on the whole Dirichlet boundary
Definition: nedelec_project_impl.h:1025
void set_identity_on_subset(int si, pot_matrix_type &A, const DoFDistribution *dd)
sets identity matrix on the closure of a full-dimensional subset
Definition: nedelec_project_impl.h:1108
void set_zero_Dirichlet(pot_vector_type &u, const DoFDistribution *dd)
sets zero values on the whole Dirichlet boundary
Definition: nedelec_project_impl.h:981
void adjust_jacobian(pot_matrix_type &J, const pot_vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< pot_vector_type > > vSol=SPNULL, const number s_a0=1.0)
sets a unity row for all conductor indices
Definition: nedelec_project_impl.h:1144
DoFDistribution::traits< Edge >::const_iterator t_edge_iterator
Iterator over edges.
Definition: nedelec_project.h:489
AuxLaplaceRHS(NedelecProject &master)
constructor
Definition: nedelec_project_impl.h:970
void adjust_solution(pot_vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
sets the value in the solution for all conductor indices
Definition: nedelec_project_impl.h:1199
Helper class for assembling the local stiffness matrix of Laplacian in various routines.
Definition: nedelec_project.h:387
static void stiffness(GridObject *elem, const position_type vCornerCoords[], number loc_A[numCorners][numCorners])
Computes the local discretization of the Laplace operator.
Definition: nedelec_project_impl.h:828
Projection procedure class.
Definition: nedelec_project.h:72
void project_func(const SmartPtr< TDomain > &domain, const SmartPtr< DoFDistribution > &edgeDD, vector_type &u, size_t fct, const SmartPtr< DoFDistribution > &vertDD, pot_gf_type &aux_rhs, pot_gf_type &aux_cor)
Projects one function (i.e. performs the main action):
Definition: nedelec_project_impl.h:247
void mark_cond_vert_elem_type(DoFDistribution &vertDD, aa_vert_cond_type &vert_base_cond)
Sets the base conductor indices for every vertex (for all elements of the same type)
Definition: nedelec_project_impl.h:702
void assemble_div(const TDomain &domain, const DoFDistribution &edgeDD, const vector_type &u, size_t fct, const DoFDistribution &vertDD, pot_vector_type &div, DenseVector< VariableArray1< number > > &charge)
Assembles the weak divergence operator on the whole grid.
Definition: nedelec_project_impl.h:404
void distribute_cor(const TDomain &domain, const DoFDistribution &edgeDD, vector_type &u, size_t fct, const DoFDistribution &vertDD, const pot_vector_type &cor)
Updates the grid function by the potential correction.
Definition: nedelec_project_impl.h:461
SmartPtr< AuxLaplaceRHS > m_auxLaplaceRHS
Rhs and BC for the auxiliary problem.
Definition: nedelec_project.h:686
SmartPtr< ApproximationSpace< TDomain > > m_spVertApproxSpace
Approximation space for the potential (vertex-centered) space.
Definition: nedelec_project.h:675
void compute_DVF_potential_coeffs(const TDomain &domain, DoFDistribution &vertDD)
Computes the potential coefficients.
Definition: nedelec_project_impl.h:617
TAlgebra::vector_type vector_type
Type of Vector (for the Nedelec-element-based grid functions)
Definition: nedelec_project.h:89
void clear_div_in_conductors(const DoFDistribution &vertDD, pot_vector_type &div, DenseVector< VariableArray1< number > > &charge)
Sets the div operator to 0 in conductors (for all elements of the same type)
Definition: nedelec_project_impl.h:358
void compute_div(SmartPtr< GridFunction< TDomain, TAlgebra > > sp_u, const char *u_fct_name, SmartPtr< GridFunction< TDomain, TPotAlgebra > > sp_div)
Computes the weak divergence in insulators.
Definition: nedelec_project_impl.h:192
SmartPtr< DomainDiscretization< TDomain, TPotAlgebra > > m_auxLaplaceAss
Global discretization of the auxiliary equations.
Definition: nedelec_project.h:688
SmartPtr< ILinearOperatorInverse< pot_vector_type > > m_potSolver
Solver for the auxliliary equations.
Definition: nedelec_project.h:692
domain_type::subset_handler_type subset_handler_type
Type of subset handler.
Definition: nedelec_project.h:84
NedelecProject(SmartPtr< EMaterial< TDomain > > emMatherial, SmartPtr< ApproximationSpace< TDomain > > vertApproxSpace, SmartPtr< ILinearOperatorInverse< pot_vector_type > > potSolver)
Constructor.
Definition: nedelec_project_impl.h:53
SmartPtr< AuxLaplaceLocAss > m_auxLocLaplace
Local discretization of the auxiliary equations.
Definition: nedelec_project.h:684
void apply(vector_type &vec)
Performs the projection of all functions in a grid function.
Definition: nedelec_project_impl.h:90
void alloc_DVFs(const TDomain &domain, pot_gf_type &aux_rhs)
Allocates memory for the DVFs associated with the ungrounded conductors.
Definition: nedelec_project_impl.h:516
TDomain::position_type position_type
position type
Definition: nedelec_project.h:106
void damp_DVFs(pot_vector_type &cor, const DenseVector< VariableArray1< number > > &charge)
Damps the Dirichlet vector fields (DVFs)
Definition: nedelec_project_impl.h:680
void integrate_div_DVF_elem_type(const TDomain &domain, const DoFDistribution &vertDD, const aa_vert_cond_type &vert_base_cond, DenseMatrix< VariableArray2< number > > &C)
Integrates div E over boundaries of conductors for elements of the same type.
Definition: nedelec_project_impl.h:746
TDomain::grid_type grid_type
Type of Grid:
Definition: nedelec_project.h:81
void compute_DVFs(pot_gf_type &aux_rhs)
Computes the Dirichlet vector fields (DVFs)
Definition: nedelec_project_impl.h:586
SmartPtr< EMaterial< TDomain > > m_spEmMaterial
Properties of the matherials in the domain.
Definition: nedelec_project.h:672
void weak_div_elem_type(const TDomain &domain, const DoFDistribution &edgeDD, const vector_type &u, size_t fct, const DoFDistribution &vertDD, pot_vector_type &div)
Computes the weak divergence (for all elements of the same type)
Definition: nedelec_project_impl.h:289
static void local_div_matrix(const TDomain *domain, TElem *elem, const position_type *corners, number B[][numEdges])
assembles the discrete weak div operator
Definition: nedelec_local_ass.h:144
SmartPtr< TDomain > domain()
SmartPtr< DoFDistribution > dof_distribution()
SmartPtr< ApproximationSpace< TDomain > > approx_space()
const GridLevel & grid_level() const
void init(SmartPtr< ApproximationSpace< TDomain > > spApproxSpace, SmartPtr< DoFDistribution > spDoFDistr, bool bManage)
TDomain::position_type position_type
bool change_storage_type(ParallelStorageType type)
void set_storage_type(uint type)
Grid::VertexAttachmentAccessor< position_attachment_type > position_accessor_type
void SetAttachmentValues(TAttachmentAccessor &aaVal, TIter elemsBegin, TIter elemsEnd, const TVal &val)
bool Invert(DenseMatrix< FixedArray2< double, 1, 1 > > &mat)
#define UG_ASSERT(expr, msg)
#define UG_CATCH_THROW(msg)
void MatVecMult(vector_t_out &vOut, const matrix_t &m, const vector_t_in &v)
vector_t::value_type VecDot(const vector_t &v1, const vector_t &v2)
const number & DoFRef(const TMatrix &mat, const DoFIndex &iInd, const DoFIndex &jInd)
void SetDirichletRow(TMatrix &mat, const DoFIndex &ind)
void VecScaleAdd(double &dest, double alpha1, const double &v1, double alpha2, const double &v2)
SurfaceView::traits< TElem >::const_iterator const_iterator
Definition: nedelec_project.h:464
Helper class for 'set_value_on_subset'.
Definition: nedelec_project.h:639
Helper class for 'set_value_on_subset'.
Definition: nedelec_project.h:605
Helper class for assembling the weak divergence operator.
Definition: nedelec_project.h:243
Helper class for computation of the charges of the DVFs.
Definition: nedelec_project.h:357
Helper class for setting the base conductor indices to vertices.
Definition: nedelec_project.h:326
Helper class for the computation the weak divergence.
Definition: nedelec_project.h:203
function ProblemDisc new(problemDesc, dom)