18 #if PETSC_VERSION_GE(3, 6, 0)
19 #include <petsc/private/dmimpl.h>
22 #include <petsc-private/dmimpl.h>
23 #include <petsc-private/vecimpl.h>
31 : mField_ptr(PETSC_NULL), isProblemBuild(PETSC_FALSE),
32 isPartitioned(PETSC_FALSE), isSquareMatrix(PETSC_TRUE),
33 isSubDM(PETSC_FALSE), isCompDM(PETSC_FALSE), destroyProblem(PETSC_FALSE),
34 verbosity(
VERBOSE), referenceNumber(0) {}
41 *iface =
const_cast<DMCtx *
>(
this);
55 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
71 CHKERR DMSetMatType(dm, MATMPIAIJ);
77 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
79 dm->data =
new DMCtx();
85 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
86 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
97 delete static_cast<DMCtx *
>(dm->data);
100 --
static_cast<DMCtx *
>(dm->data)->referenceNumber;
106 const char problem_name[],
111 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
114 "data structure for MoFEM not yet created");
118 "DM function not implemented into MoFEM");
136 boost::shared_ptr<KspCtx>(
new KspCtx(*m_field_ptr, problem_name));
138 boost::shared_ptr<SnesCtx>(
new SnesCtx(*m_field_ptr, problem_name));
140 boost::shared_ptr<TsCtx>(
new TsCtx(*m_field_ptr, problem_name));
143 CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
145 MPI_Comm_compare(comm, m_field_ptr->
get_comm(), &result);
146 if (result > MPI_CONGRUENT) {
148 "MoFEM and DM using different communicators");
150 MPI_Comm_size(comm, &dm_field->
sIze);
151 MPI_Comm_rank(comm, &dm_field->
rAnk);
163 auto *dm_field =
static_cast<DMCtx *
>(dm->data);
166 "data structure for MoFEM not yet created");
169 delete static_cast<DMCtx *
>(dm_duplicate->data);
171 dm_duplicate->data = dm->data;
172 ++(
static_cast<DMCtx *
>(dm_duplicate->data)->referenceNumber);
180 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
183 "data structure for MoFEM not yet created");
189 subdm_field->
isSubDM = PETSC_TRUE;
199 EntityType lo_type, EntityType hi_type) {
200 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
202 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
205 "data structure for MoFEM not yet created");
210 dm_field->
rowFields.push_back(field_name);
211 if (lo_type != MBVERTEX || hi_type != MBMAXTYPE) {
214 std::map<std::string, std::pair<EntityType, EntityType>>>();
216 std::pair<EntityType, EntityType>(lo_type, hi_type);
222 EntityType lo_type, EntityType hi_type) {
223 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
225 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
228 "data structure for MoFEM not yet created");
233 dm_field->
colFields.push_back(field_name);
234 if (lo_type != MBVERTEX || hi_type != MBMAXTYPE) {
237 std::map<std::string, std::pair<EntityType, EntityType>>>();
239 std::pair<EntityType, EntityType>(lo_type, hi_type);
246 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
248 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
249 *is_sub_dm = dm_field->
isSubDM;
255 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
257 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
258 if (dm_field->
isSubDM != PETSC_TRUE) {
260 "This DM is not created as a SubDM");
265 boost::shared_ptr<Problem::SubProblemData> sub_data =
267 CHKERR sub_data->getRowIs(is);
273 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
275 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
276 if (dm_field->
isSubDM != PETSC_TRUE) {
278 "This DM is not created as a SubDM");
283 boost::shared_ptr<Problem::SubProblemData> sub_data =
285 CHKERR sub_data->getColIs(is);
290 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
292 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
295 "data structure for MoFEM not yet created");
308 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
310 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
313 "data structure for MoFEM not yet created");
320 "No need to add problem on column when problem block structurally "
329 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
331 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
337 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
339 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
342 "data structure for MoFEM not yet created");
349 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
351 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
354 "data structure for MoFEM not yet created");
362 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
364 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
371 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
373 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
380 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
382 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
389 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
391 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
393 ->resolveSharedFiniteElements(dm_field->
problemPtr, fe_name);
402 PetscLayout *layout) {
404 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
406 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
409 CHKERR PetscObjectGetComm((PetscObject)dm, &comm);
418 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
420 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
426 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
428 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
436 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
438 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
446 ScatterMode scatter_mode) {
448 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
450 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
458 ScatterMode scatter_mode) {
459 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
461 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
469 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
471 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
479 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
481 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
490 int low_rank,
int up_rank) {
492 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
494 dm_field->
problemPtr, fe_name, *method, low_rank, up_rank);
501 boost::shared_ptr<MoFEM::FEMethod> method,
502 int low_rank,
int up_rank) {
509 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
511 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
520 boost::shared_ptr<MoFEM::FEMethod> method) {
526 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
528 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
531 *method, dm_field->
rAnk, dm_field->
rAnk);
536 template <
class S,
class T0,
class T1,
class T2>
538 T1 pre_only, T2 post_only) {
539 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
541 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
543 dm_field->
kspCtx->get_preProcess_to_do_Rhs().push_back(pre_only);
546 dm_field->
kspCtx->get_loops_to_do_Rhs().push_back(
550 dm_field->
kspCtx->get_postProcess_to_do_Rhs().push_back(post_only);
562 dm, fe_name, method, pre_only, post_only);
567 boost::shared_ptr<MoFEM::FEMethod> method,
568 boost::shared_ptr<MoFEM::BasicMethod> pre_only,
569 boost::shared_ptr<MoFEM::BasicMethod> post_only) {
571 boost::shared_ptr<MoFEM::FEMethod>,
572 boost::shared_ptr<MoFEM::BasicMethod>,
573 boost::shared_ptr<MoFEM::BasicMethod>>(
574 dm, fe_name, method, pre_only, post_only);
577 template <
class S,
class T0,
class T1,
class T2>
579 T1 pre_only, T2 post_only) {
580 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
582 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
584 dm_field->
kspCtx->get_preProcess_to_do_Mat().push_back(pre_only);
587 dm_field->
kspCtx->get_loops_to_do_Mat().push_back(
591 dm_field->
kspCtx->get_postProcess_to_do_Mat().push_back(post_only);
604 dm, fe_name, method, pre_only, post_only);
609 boost::shared_ptr<MoFEM::FEMethod> method,
610 boost::shared_ptr<MoFEM::BasicMethod> pre_only,
611 boost::shared_ptr<MoFEM::BasicMethod> post_only) {
613 boost::shared_ptr<MoFEM::FEMethod>>(
614 dm, fe_name, method, pre_only, post_only);
617 template <
class S,
class T0,
class T1,
class T2>
619 T1 pre_only, T2 post_only) {
620 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
622 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
624 dm_field->
snesCtx->get_preProcess_to_do_Rhs().push_back(pre_only);
627 dm_field->
snesCtx->get_loops_to_do_Rhs().push_back(
631 dm_field->
snesCtx->get_postProcess_to_do_Rhs().push_back(post_only);
643 dm, fe_name, method, pre_only, post_only);
648 boost::shared_ptr<MoFEM::FEMethod> method,
649 boost::shared_ptr<MoFEM::BasicMethod> pre_only,
650 boost::shared_ptr<MoFEM::BasicMethod> post_only) {
652 boost::shared_ptr<MoFEM::FEMethod>,
653 boost::shared_ptr<MoFEM::BasicMethod>,
654 boost::shared_ptr<MoFEM::BasicMethod>>(
655 dm, fe_name, method, pre_only, post_only);
658 template <
class S,
class T0,
class T1,
class T2>
660 T1 pre_only, T2 post_only) {
661 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
663 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
665 dm_field->
snesCtx->get_preProcess_to_do_Mat().push_back(pre_only);
668 dm_field->
snesCtx->get_loops_to_do_Mat().push_back(
672 dm_field->
snesCtx->get_postProcess_to_do_Mat().push_back(post_only);
684 dm, fe_name, method, pre_only, post_only);
689 boost::shared_ptr<MoFEM::FEMethod> method,
690 boost::shared_ptr<MoFEM::BasicMethod> pre_only,
691 boost::shared_ptr<MoFEM::BasicMethod> post_only) {
693 boost::shared_ptr<MoFEM::FEMethod>,
694 boost::shared_ptr<MoFEM::BasicMethod>,
695 boost::shared_ptr<MoFEM::BasicMethod>>(
696 dm, fe_name, method, pre_only, post_only);
699 template <
class S,
class T0,
class T1,
class T2>
701 T1 pre_only, T2 post_only) {
702 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
704 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
706 dm_field->
tsCtx->get_preProcess_to_do_IFunction().push_back(pre_only);
709 dm_field->
tsCtx->get_loops_to_do_IFunction().push_back(
713 dm_field->
tsCtx->get_postProcess_to_do_IFunction().push_back(post_only);
725 dm, fe_name, method, pre_only, post_only);
731 boost::shared_ptr<MoFEM::FEMethod> method,
732 boost::shared_ptr<MoFEM::BasicMethod> pre_only,
733 boost::shared_ptr<MoFEM::BasicMethod> post_only) {
735 boost::shared_ptr<MoFEM::FEMethod>,
736 boost::shared_ptr<MoFEM::BasicMethod>,
737 boost::shared_ptr<MoFEM::BasicMethod>>(
738 dm, fe_name, method, pre_only, post_only);
742 template <
class S,
class T0,
class T1,
class T2>
744 T1 pre_only, T2 post_only) {
745 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
747 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
749 dm_field->
tsCtx->get_preProcess_to_do_IJacobian().push_back(pre_only);
752 dm_field->
tsCtx->get_loops_to_do_IJacobian().push_back(
756 dm_field->
tsCtx->get_postProcess_to_do_IJacobian().push_back(post_only);
768 pre_only, post_only);
773 boost::shared_ptr<MoFEM::FEMethod> method,
774 boost::shared_ptr<MoFEM::BasicMethod> pre_only,
775 boost::shared_ptr<MoFEM::BasicMethod> post_only) {
777 boost::shared_ptr<MoFEM::FEMethod>,
778 boost::shared_ptr<MoFEM::BasicMethod>,
779 boost::shared_ptr<MoFEM::BasicMethod>>(
780 dm, fe_name, method, pre_only, post_only);
783 template <
class S,
class T0,
class T1,
class T2>
785 T1 pre_only, T2 post_only) {
786 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
788 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
790 dm_field->
tsCtx->get_preProcess_to_do_RHSFunction().push_back(pre_only);
792 dm_field->
tsCtx->get_loops_to_do_RHSFunction().push_back(
795 dm_field->
tsCtx->get_postProcess_to_do_RHSFunction().push_back(post_only);
802 boost::shared_ptr<MoFEM::FEMethod> method,
803 boost::shared_ptr<MoFEM::BasicMethod> pre_only,
804 boost::shared_ptr<MoFEM::BasicMethod> post_only) {
806 boost::shared_ptr<MoFEM::FEMethod>,
807 boost::shared_ptr<MoFEM::BasicMethod>,
808 boost::shared_ptr<MoFEM::BasicMethod>>(
809 dm, fe_name, method, pre_only, post_only);
813 template <
class S,
class T0,
class T1,
class T2>
815 T1 pre_only, T2 post_only) {
816 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
818 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
820 dm_field->
tsCtx->get_preProcess_to_do_RHSFunction().push_back(pre_only);
822 dm_field->
tsCtx->get_loops_to_do_RHSFunction().push_back(
825 dm_field->
tsCtx->get_postProcess_to_do_RHSFunction().push_back(post_only);
832 boost::shared_ptr<MoFEM::FEMethod> method,
833 boost::shared_ptr<MoFEM::BasicMethod> pre_only,
834 boost::shared_ptr<MoFEM::BasicMethod> post_only) {
836 boost::shared_ptr<MoFEM::FEMethod>,
837 boost::shared_ptr<MoFEM::BasicMethod>,
838 boost::shared_ptr<MoFEM::BasicMethod>>(
839 dm, fe_name, method, pre_only, post_only);
845 boost::shared_ptr<MoFEM::FEMethod> method,
846 boost::shared_ptr<MoFEM::BasicMethod> pre_only,
847 boost::shared_ptr<MoFEM::BasicMethod> post_only) {
848 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
850 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
852 dm_field->
tsCtx->get_preProcess_to_do_IFunction().push_back(pre_only);
855 dm_field->
tsCtx->get_loops_to_do_IFunction().push_back(
859 dm_field->
tsCtx->get_postProcess_to_do_IFunction().push_back(post_only);
867 boost::shared_ptr<MoFEM::FEMethod> method,
868 boost::shared_ptr<MoFEM::BasicMethod> pre_only,
869 boost::shared_ptr<MoFEM::BasicMethod> post_only) {
870 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
872 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
874 dm_field->
tsCtx->get_preProcess_to_do_IJacobian().push_back(pre_only);
877 dm_field->
tsCtx->get_loops_to_do_IJacobian().push_back(
881 dm_field->
tsCtx->get_postProcess_to_do_IJacobian().push_back(post_only);
887 template <
class S,
class T0,
class T1,
class T2>
889 T1 pre_only, T2 post_only) {
890 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
892 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
894 dm_field->
tsCtx->get_preProcess_to_do_Monitor().push_back(pre_only);
896 dm_field->
tsCtx->get_loops_to_do_Monitor().push_back(
899 dm_field->
tsCtx->get_postProcess_to_do_Monitor().push_back(post_only);
910 dm, ts, fe_name, method, pre_only, post_only);
916 boost::shared_ptr<MoFEM::FEMethod> method,
917 boost::shared_ptr<MoFEM::BasicMethod> pre_only,
918 boost::shared_ptr<MoFEM::BasicMethod> post_only) {
920 boost::shared_ptr<MoFEM::FEMethod>,
921 boost::shared_ptr<MoFEM::BasicMethod>,
922 boost::shared_ptr<MoFEM::BasicMethod>>(
923 dm, ts, fe_name, method, pre_only, post_only);
928 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
930 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
931 *ksp_ctx = dm_field->
kspCtx.get();
937 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
939 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
940 const_cast<boost::shared_ptr<MoFEM::KspCtx> &
>(ksp_ctx) = dm_field->
kspCtx;
945 boost::shared_ptr<MoFEM::KspCtx> &ksp_ctx) {
946 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
948 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
949 dm_field->
kspCtx = ksp_ctx;
954 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
957 *snes_ctx = dm_field->
snesCtx.get();
963 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
965 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
966 const_cast<boost::shared_ptr<MoFEM::SnesCtx> &
>(snes_ctx) = dm_field->
snesCtx;
971 boost::shared_ptr<MoFEM::SnesCtx> &snes_ctx) {
972 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
974 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
983 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
985 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
994 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
996 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1002 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1004 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1005 *ts_ctx = dm_field->
tsCtx.get();
1010 const boost::shared_ptr<MoFEM::TsCtx> &ts_ctx) {
1011 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1013 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1014 const_cast<boost::shared_ptr<MoFEM::TsCtx> &
>(ts_ctx) = dm_field->
tsCtx;
1019 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1021 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1022 dm_field->
tsCtx = ts_ctx;
1027 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1029 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1036 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1038 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1045 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1047 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1054 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1056 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1057 if (strcmp(dm->mattype, MATMPIAIJ) == 0) {
1059 ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(dm_field->
problemName,
1061 }
else if (strcmp(dm->mattype, MATAIJ) == 0) {
1063 ->createSeqAIJWithArrays<PetscLocalIdx_mi_tag>(dm_field->
problemName,
1067 "Matrix type not implemented");
1073 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1075 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1076 if (strcmp(dm->mattype, MATMPIAIJ) == 0) {
1078 ->createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(dm_field->
problemName,
1080 }
else if (strcmp(dm->mattype, MATAIJ) == 0) {
1082 ->createSeqAIJWithArrays<PetscLocalIdx_mi_tag>(dm_field->
problemName,
1086 "Matrix type not implemented");
1091 #if PETSC_VERSION_GE(3, 7, 0)
1094 #elif PETSC_VERSION_GE(3, 5, 3)
1100 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1102 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1103 #if PETSC_VERSION_GE(3, 5, 3)
1104 ierr = PetscOptionsHead(PetscOptionsObject,
"DMMoFEM Options");
1107 ierr = PetscOptionsHead(
"DMMoFEM Options");
1110 ierr = PetscOptionsBool(
"-dm_is_partitioned",
1111 "set if mesh is partitioned (works which native MOAB "
1112 "file format, i.e. h5m",
1120 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1123 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1167 PetscValidHeaderSpecific(subdm, DM_CLASSID, 1);
1171 DMCtx *subdm_field =
static_cast<DMCtx *
>(subdm->data);
1176 map<std::string, std::pair<EntityType, EntityType>> *entity_map_row =
nullptr;
1177 map<std::string, std::pair<EntityType, EntityType>> *entity_map_col =
nullptr;
1180 entity_map_row = subdm_field->
mapTypeRow.get();
1182 entity_map_row = subdm_field->
mapTypeCol.get();
1187 subdm_field->
isSquareMatrix == PETSC_TRUE, entity_map_row, entity_map_col,
1194 0, subdm_field->
sIze,
1215 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1217 CHKERR VecGhostUpdateBegin(g, INSERT_VALUES, SCATTER_FORWARD);
1223 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1226 CHKERR VecGhostUpdateEnd(g, INSERT_VALUES, SCATTER_FORWARD);
1228 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1232 double *array_loc, *array_glob;
1233 CHKERR VecGetArray(
l, &array_loc);
1234 CHKERR VecGetArray(g, &array_glob);
1237 cblas_dcopy(nb_dofs + nb_ghost, array_glob, 1, array_loc, 1);
1240 cblas_daxpy(nb_dofs + nb_ghost, 1, array_glob, 1, array_loc, 1);
1245 CHKERR VecRestoreArray(
l, &array_loc);
1246 CHKERR VecRestoreArray(g, &array_glob);
1253 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1256 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1260 double *array_loc, *array_glob;
1261 CHKERR VecGetArray(
l, &array_loc);
1262 CHKERR VecGetArray(g, &array_glob);
1265 cblas_dcopy(nb_dofs + nb_ghost, array_loc, 1, array_glob, 1);
1268 cblas_daxpy(nb_dofs + nb_ghost, 1, array_loc, 1, array_glob, 1);
1273 CHKERR VecRestoreArray(
l, &array_loc);
1274 CHKERR VecRestoreArray(g, &array_glob);
1286 char ***fieldNames, IS **fields) {
1287 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1300 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1302 Field_multiIndex::iterator fit, hi_fit;
1303 fit = fields_ptr->begin();
1304 hi_fit = fields_ptr->end();
1305 *numFields = std::distance(fit, hi_fit);
1308 CHKERR PetscMalloc1(*numFields, fieldNames);
1311 CHKERR PetscMalloc1(*numFields, fields);
1314 for (
int f = 0; fit != hi_fit; fit++,
f++) {
1316 CHKERR PetscStrallocpy(fit->get()->getName().c_str(),
1317 (
char **)&(*fieldNames)[
f]);
1321 ->isCreateProblemFieldAndRank(
1323 fit->get()->getNbOfCoeffs(), &(*fields)[
f]);
1332 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1334 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);
1337 field_name, 0, 1000, is);
1342 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
1344 DMCtx *dm_field =
static_cast<DMCtx *
>(dm->data);