17 #ifndef dealii_mesh_worker_assembler_h 18 #define dealii_mesh_worker_assembler_h 112 template <
typename VectorType>
136 template <
class DOFINFO>
144 template <
class DOFINFO>
151 template <
class DOFINFO>
153 assemble(
const DOFINFO &info1,
const DOFINFO &info2);
162 const std::vector<types::global_dof_index> &dof);
212 template <
typename MatrixType,
typename number =
double>
244 template <
class DOFINFO>
252 template <
class DOFINFO>
259 template <
class DOFINFO>
261 assemble(
const DOFINFO &info1,
const DOFINFO &info2);
270 const unsigned int block_row,
271 const unsigned int block_col,
272 const std::vector<types::global_dof_index> &dof1,
273 const std::vector<types::global_dof_index> &dof2);
328 template <
typename MatrixType,
typename number =
double>
362 initialize_edge_flux(MatrixPtrVector &up, MatrixPtrVector &down);
370 initialize_interfaces(MatrixPtrVector &interface_in,
371 MatrixPtrVector &interface_out);
379 template <
class DOFINFO>
387 template <
class DOFINFO>
394 template <
class DOFINFO>
396 assemble(
const DOFINFO &info1,
const DOFINFO &info2);
405 const unsigned int block_row,
406 const unsigned int block_col,
407 const std::vector<types::global_dof_index> &dof1,
408 const std::vector<types::global_dof_index> &dof2,
409 const unsigned int level1,
410 const unsigned int level2,
417 assemble_fluxes(MatrixType & global,
419 const unsigned int block_row,
420 const unsigned int block_col,
421 const std::vector<types::global_dof_index> &dof1,
422 const std::vector<types::global_dof_index> &dof2,
423 const unsigned int level1,
424 const unsigned int level2);
430 assemble_up(MatrixType & global,
432 const unsigned int block_row,
433 const unsigned int block_col,
434 const std::vector<types::global_dof_index> &dof1,
435 const std::vector<types::global_dof_index> &dof2,
436 const unsigned int level1,
437 const unsigned int level2);
443 assemble_down(MatrixType & global,
445 const unsigned int block_row,
446 const unsigned int block_col,
447 const std::vector<types::global_dof_index> &dof1,
448 const std::vector<types::global_dof_index> &dof2,
449 const unsigned int level1,
450 const unsigned int level2);
456 assemble_in(MatrixType & global,
458 const unsigned int block_row,
459 const unsigned int block_col,
460 const std::vector<types::global_dof_index> &dof1,
461 const std::vector<types::global_dof_index> &dof2,
462 const unsigned int level1,
463 const unsigned int level2);
469 assemble_out(MatrixType & global,
471 const unsigned int block_row,
472 const unsigned int block_col,
473 const std::vector<types::global_dof_index> &dof1,
474 const std::vector<types::global_dof_index> &dof2,
475 const unsigned int level1,
476 const unsigned int level2);
532 template <
typename VectorType>
542 template <
typename VectorType>
551 template <
typename VectorType>
552 template <
class DOFINFO>
561 template <
typename VectorType>
566 const std::vector<types::global_dof_index> &dof)
570 for (
unsigned int b = 0;
b < local.
n_blocks(); ++
b)
571 for (
unsigned int j = 0; j < local.
block(
b).size(); ++j)
581 const unsigned int jcell =
583 global(dof[jcell]) += local.
block(
b)(j);
587 constraints->distribute_local_to_global(local, dof, global);
591 template <
typename VectorType>
592 template <
class DOFINFO>
603 template <
typename VectorType>
604 template <
class DOFINFO>
607 const DOFINFO &info1,
608 const DOFINFO &info2)
624 template <
typename MatrixType,
typename number>
627 : threshold(threshold)
631 template <
typename MatrixType,
typename number>
643 template <
typename MatrixType,
typename number>
653 template <
typename MatrixType,
typename number>
654 template <
class DOFINFO>
660 info.initialize_matrices(*
matrices, face);
665 template <
typename MatrixType,
typename number>
670 const unsigned int block_row,
671 const unsigned int block_col,
672 const std::vector<types::global_dof_index> &dof1,
673 const std::vector<types::global_dof_index> &dof2)
677 for (
unsigned int j = 0; j < local.n_rows(); ++j)
678 for (
unsigned int k = 0; k < local.n_cols(); ++k)
689 const unsigned int jcell =
690 this->
block_info->local().local_to_global(block_row, j);
691 const unsigned int kcell =
692 this->
block_info->local().local_to_global(block_col, k);
694 global.
add(dof1[jcell], dof2[kcell], local(j, k));
700 std::vector<types::global_dof_index> sliced_row_indices(
702 for (
unsigned int i = 0; i < sliced_row_indices.size(); ++i)
703 sliced_row_indices[i] = dof1[bi.
block_start(block_row) + i];
705 std::vector<types::global_dof_index> sliced_col_indices(
707 for (
unsigned int i = 0; i < sliced_col_indices.size(); ++i)
708 sliced_col_indices[i] = dof2[bi.
block_start(block_col) + i];
718 template <
typename MatrixType,
typename number>
719 template <
class DOFINFO>
724 for (
unsigned int i = 0; i <
matrices->size(); ++i)
732 info.matrix(i,
false).matrix,
741 template <
typename MatrixType,
typename number>
742 template <
class DOFINFO>
745 const DOFINFO &info1,
746 const DOFINFO &info2)
748 for (
unsigned int i = 0; i <
matrices->size(); ++i)
756 info1.matrix(i,
false).matrix,
762 info1.matrix(i,
true).matrix,
768 info2.matrix(i,
false).matrix,
774 info2.matrix(i,
true).matrix,
785 template <
typename MatrixType,
typename number>
788 : threshold(threshold)
792 template <
typename MatrixType,
typename number>
804 template <
typename MatrixType,
typename number>
813 template <
typename MatrixType,
typename number>
814 template <
class DOFINFO>
820 info.initialize_matrices(*
matrices, face);
825 template <
typename MatrixType,
typename number>
836 template <
typename MatrixType,
typename number>
846 template <
typename MatrixType,
typename number>
851 const unsigned int block_row,
852 const unsigned int block_col,
853 const std::vector<types::global_dof_index> &dof1,
854 const std::vector<types::global_dof_index> &dof2,
855 const unsigned int level1,
856 const unsigned int level2,
859 for (
unsigned int j = 0; j < local.n_rows(); ++j)
860 for (
unsigned int k = 0; k < local.n_cols(); ++k)
871 const unsigned int jcell =
872 this->
block_info->local().local_to_global(block_row, j);
873 const unsigned int kcell =
874 this->
block_info->local().local_to_global(block_col, k);
884 const unsigned int jglobal = this->
block_info->level(level1)
885 .global_to_local(dof1[jcell])
887 const unsigned int kglobal = this->
block_info->level(level2)
888 .global_to_local(dof2[kcell])
894 global.add(kglobal, jglobal, local(j, k));
896 global.add(jglobal, kglobal, local(j, k));
917 global.add(kglobal, jglobal, local(j, k));
919 global.add(jglobal, kglobal, local(j, k));
925 global.add(kglobal, jglobal, local(j, k));
927 global.add(jglobal, kglobal, local(j, k));
935 template <
typename MatrixType,
typename number>
940 const unsigned int block_row,
941 const unsigned int block_col,
942 const std::vector<types::global_dof_index> &dof1,
943 const std::vector<types::global_dof_index> &dof2,
944 const unsigned int level1,
945 const unsigned int level2)
947 for (
unsigned int j = 0; j < local.n_rows(); ++j)
948 for (
unsigned int k = 0; k < local.n_cols(); ++k)
959 const unsigned int jcell =
960 this->
block_info->local().local_to_global(block_row, j);
961 const unsigned int kcell =
962 this->
block_info->local().local_to_global(block_col, k);
972 const unsigned int jglobal = this->
block_info->level(level1)
973 .global_to_local(dof1[jcell])
975 const unsigned int kglobal = this->
block_info->level(level2)
976 .global_to_local(dof2[kcell])
980 global.add(jglobal, kglobal, local(j, k));
992 global.add(jglobal, kglobal, local(j, k));
998 template <
typename MatrixType,
typename number>
1001 MatrixType & global,
1003 const unsigned int block_row,
1004 const unsigned int block_col,
1005 const std::vector<types::global_dof_index> &dof1,
1006 const std::vector<types::global_dof_index> &dof2,
1007 const unsigned int level1,
1008 const unsigned int level2)
1010 for (
unsigned int j = 0; j < local.n_rows(); ++j)
1011 for (
unsigned int k = 0; k < local.n_cols(); ++k)
1022 const unsigned int jcell =
1023 this->
block_info->local().local_to_global(block_row, j);
1024 const unsigned int kcell =
1025 this->
block_info->local().local_to_global(block_col, k);
1035 const unsigned int jglobal = this->
block_info->level(level1)
1036 .global_to_local(dof1[jcell])
1038 const unsigned int kglobal = this->
block_info->level(level2)
1039 .global_to_local(dof2[kcell])
1043 global.add(jglobal, kglobal, local(j, k));
1055 global.add(jglobal, kglobal, local(j, k));
1061 template <
typename MatrixType,
typename number>
1064 MatrixType & global,
1066 const unsigned int block_row,
1067 const unsigned int block_col,
1068 const std::vector<types::global_dof_index> &dof1,
1069 const std::vector<types::global_dof_index> &dof2,
1070 const unsigned int level1,
1071 const unsigned int level2)
1073 for (
unsigned int j = 0; j < local.n_rows(); ++j)
1074 for (
unsigned int k = 0; k < local.n_cols(); ++k)
1085 const unsigned int jcell =
1086 this->
block_info->local().local_to_global(block_row, j);
1087 const unsigned int kcell =
1088 this->
block_info->local().local_to_global(block_col, k);
1098 const unsigned int jglobal = this->
block_info->level(level1)
1099 .global_to_local(dof1[jcell])
1101 const unsigned int kglobal = this->
block_info->level(level2)
1102 .global_to_local(dof2[kcell])
1106 global.add(jglobal, kglobal, local(k, j));
1118 global.add(jglobal, kglobal, local(k, j));
1124 template <
typename MatrixType,
typename number>
1127 MatrixType & global,
1129 const unsigned int block_row,
1130 const unsigned int block_col,
1131 const std::vector<types::global_dof_index> &dof1,
1132 const std::vector<types::global_dof_index> &dof2,
1133 const unsigned int level1,
1134 const unsigned int level2)
1139 for (
unsigned int j = 0; j < local.n_rows(); ++j)
1140 for (
unsigned int k = 0; k < local.n_cols(); ++k)
1151 const unsigned int jcell =
1152 this->
block_info->local().local_to_global(block_row, j);
1153 const unsigned int kcell =
1154 this->
block_info->local().local_to_global(block_col, k);
1164 const unsigned int jglobal = this->
block_info->level(level1)
1165 .global_to_local(dof1[jcell])
1167 const unsigned int kglobal = this->
block_info->level(level2)
1168 .global_to_local(dof2[kcell])
1172 global.add(jglobal, kglobal, local(j, k));
1184 level2, kglobal)) ||
1189 jglobal == kglobal))
1190 global.add(jglobal, kglobal, local(j, k));
1193 global.add(jglobal, kglobal, local(j, k));
1199 template <
typename MatrixType,
typename number>
1202 MatrixType & global,
1204 const unsigned int block_row,
1205 const unsigned int block_col,
1206 const std::vector<types::global_dof_index> &dof1,
1207 const std::vector<types::global_dof_index> &dof2,
1208 const unsigned int level1,
1209 const unsigned int level2)
1214 for (
unsigned int j = 0; j < local.n_rows(); ++j)
1215 for (
unsigned int k = 0; k < local.n_cols(); ++k)
1226 const unsigned int jcell =
1227 this->
block_info->local().local_to_global(block_row, j);
1228 const unsigned int kcell =
1229 this->
block_info->local().local_to_global(block_col, k);
1239 const unsigned int jglobal = this->
block_info->level(level1)
1240 .global_to_local(dof1[jcell])
1242 const unsigned int kglobal = this->
block_info->level(level2)
1243 .global_to_local(dof2[kcell])
1247 global.add(jglobal, kglobal, local(k, j));
1259 level2, kglobal)) ||
1264 jglobal == kglobal))
1265 global.add(jglobal, kglobal, local(k, j));
1268 global.add(jglobal, kglobal, local(k, j));
1275 template <
typename MatrixType,
typename number>
1276 template <
class DOFINFO>
1279 const DOFINFO &info)
1281 const unsigned int level = info.cell->level();
1291 info.matrix(i,
false).matrix,
1302 info.matrix(i,
false).matrix,
1311 info.matrix(i,
false).matrix,
1320 info.matrix(i,
false).matrix,
1328 info.matrix(i,
false).matrix,
1340 template <
typename MatrixType,
typename number>
1341 template <
class DOFINFO>
1344 const DOFINFO &info1,
1345 const DOFINFO &info2)
1347 const unsigned int level1 = info1.cell->level();
1348 const unsigned int level2 = info2.cell->level();
1356 const unsigned int row = o[level1].row;
1357 const unsigned int col = o[level1].column;
1359 if (level1 == level2)
1364 info1.matrix(i,
false).matrix,
1372 info1.matrix(i,
true).matrix,
1380 info2.matrix(i,
false).matrix,
1388 info2.matrix(i,
true).matrix,
1399 info1.matrix(i,
false).matrix,
1407 info1.matrix(i,
true).matrix,
1415 info2.matrix(i,
false).matrix,
1423 info2.matrix(i,
true).matrix,
1441 info1.matrix(i,
false).matrix,
1449 info1.matrix(i,
true).matrix,
1457 info2.matrix(i,
true).matrix,
SmartPointer< const BlockInfo, MatrixLocalBlocksToGlobalBlocks< MatrixType, number > > block_info
MatrixPtrVectorPtr interface_out
SmartPointer< const AffineConstraints< typename VectorType::value_type >, ResidualLocalBlocksToGlobalBlocks< VectorType > > constraints
void assemble_down(MatrixType &global, const FullMatrix< number > &local, const unsigned int block_row, const unsigned int block_col, const std::vector< types::global_dof_index > &dof1, const std::vector< types::global_dof_index > &dof2, const unsigned int level1, const unsigned int level2)
type entry(const std::string &name)
Access to stored data object by name.
#define AssertDimension(dim1, dim2)
void initialize_edge_flux(MatrixPtrVector &up, MatrixPtrVector &down)
Contents is actually a matrix.
void initialize(const BlockInfo *block_info, AnyData &residuals)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SmartPointer< const MGConstrainedDoFs, MGMatrixLocalBlocksToGlobalBlocks< MatrixType, number > > mg_constrained_dofs
void initialize_info(DOFINFO &info, bool face) const
const value_type & block(size_type i) const
SmartPointer< const AffineConstraints< typename MatrixType::value_type >, MatrixLocalBlocksToGlobalBlocks< MatrixType, number > > constraints
void add(const size_type i, const size_type j, const typename MatrixType::value_type value)
MGMatrixLocalBlocksToGlobalBlocks(double threshold=1.e-12)
size_type block_size(const unsigned int i) const
void initialize_info(DOFINFO &info, bool face) const
const value_type & block_out(size_type i) const
MatrixPtrVectorPtr flux_up
#define Assert(cond, exc)
void assemble_fluxes(MatrixType &global, const FullMatrix< number > &local, const unsigned int block_row, const unsigned int block_col, const std::vector< types::global_dof_index > &dof1, const std::vector< types::global_dof_index > &dof2, const unsigned int level1, const unsigned int level2)
SmartPointer< const BlockInfo, MGMatrixLocalBlocksToGlobalBlocks< MatrixType, number > > block_info
void assemble(const DOFINFO &info)
#define DEAL_II_NAMESPACE_CLOSE
MatrixPtrVectorPtr flux_down
Expression fabs(const Expression &x)
const value_type & block_in(size_type i) const
void initialize(const BlockInfo *block_info, MatrixBlockVector< MatrixType > &matrices)
SmartPointer< const BlockInfo, ResidualLocalBlocksToGlobalBlocks< VectorType > > block_info
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
unsigned int size() const
void assemble_out(MatrixType &global, const FullMatrix< number > &local, const unsigned int block_row, const unsigned int block_col, const std::vector< types::global_dof_index > &dof1, const std::vector< types::global_dof_index > &dof2, const unsigned int level1, const unsigned int level2)
unsigned int n_blocks() const
void initialize_interfaces(MatrixPtrVector &interface_in, MatrixPtrVector &interface_out)
unsigned int size() const
Number of stored data objects.
#define DEAL_II_NAMESPACE_OPEN
void assemble_up(MatrixType &global, const FullMatrix< number > &local, const unsigned int block_row, const unsigned int block_col, const std::vector< types::global_dof_index > &dof1, const std::vector< types::global_dof_index > &dof2, const unsigned int level1, const unsigned int level2)
void assemble(const DOFINFO &info)
size_type block_start(const unsigned int i) const
A small class collecting the different BlockIndices involved in global, multilevel and local computat...
void assemble(const DOFINFO &info)
static ::ExceptionBase & ExcNotImplemented()
MatrixPtrVectorPtr interface_in
SmartPointer< MatrixBlockVector< MatrixType >, MatrixLocalBlocksToGlobalBlocks< MatrixType, number > > matrices
BlockType & block(const unsigned int i)
void initialize_info(DOFINFO &info, bool face) const
MatrixLocalBlocksToGlobalBlocks(double threshold=1.e-12)
MatrixPtrVectorPtr matrices
void initialize(const BlockInfo *block_info, MatrixPtrVector &matrices)
void assemble_in(MatrixType &global, const FullMatrix< number > &local, const unsigned int block_row, const unsigned int block_col, const std::vector< types::global_dof_index > &dof1, const std::vector< types::global_dof_index > &dof2, const unsigned int level1, const unsigned int level2)