15 boost::shared_ptr<ArcLengthCtx>
arcPtr;
26 boost::shared_ptr<ArcLengthCtx> arcptr):
28 PetscInt ghosts[1] = { 0 };
30 if(pcomm->rank() == 0) {
37 for(Range::iterator pit = prisms.begin();pit!=prisms.end();pit++) {
54 double def_damaged = 0;
70 std::vector<int> is_prism_damaged(prisms.size());
72 Range::iterator pit = prisms.begin();
73 std::vector<int>::iterator vit = is_prism_damaged.begin();
74 for(;pit!=prisms.end();pit++,vit++) {
78 for(Range::iterator nit = nodes.begin();nit!=nodes.end();nit++) {
91 case CTX_SNESSETFUNCTION: {
106 NumeredDofEntityByLocalIdx::iterator dit,hi_dit;
107 dit = problemPtr->getNumeredRowDofsPtr()->get<PetscLocalIdx_mi_tag>().lower_bound(0);
108 hi_dit = problemPtr->getNumeredRowDofsPtr()->get<PetscLocalIdx_mi_tag>().upper_bound(problemPtr->getNbLocalDofsRow());
110 double *array_int_lambda;
116 array_int_lambda[0] = 0;
117 for(;dit!=hi_dit;dit++) {
118 if(dit->get()->getEntType() != MBVERTEX)
continue;
119 if(pcomm->rank() != dit->get()->getPart())
continue;
121 array_int_lambda[0] += array[dit->get()->getPetscLocalDofIdx()];
124 array_int_lambda[0] -= array[dit->get()->getPetscLocalDofIdx()];
150 NumeredDofEntityByLocalIdx::iterator dit,hi_dit;
151 dit = problemPtr->getNumeredRowDofsPtr()->get<PetscLocalIdx_mi_tag>().lower_bound(0);
152 hi_dit = problemPtr->getNumeredRowDofsPtr()->get<PetscLocalIdx_mi_tag>().upper_bound(
153 problemPtr->getNbLocalDofsRow()+problemPtr->getNbGhostDofsRow()
157 for(;dit!=hi_dit;dit++) {
158 if(dit->get()->getEntType() != MBVERTEX) {
159 array[dit->get()->getPetscLocalDofIdx()] = 0;
163 array[dit->get()->getPetscLocalDofIdx()] = +
arcPtr->alpha;
164 }
else if(
Nodes4.find(dit->get()->getEnt())!=
Nodes4.end()) {
165 array[dit->get()->getPetscLocalDofIdx()] = -
arcPtr->alpha;
166 }
else array[dit->get()->getPetscLocalDofIdx()] = 0;
176 case CTX_SNESSETFUNCTION: {
180 PetscPrintf(PETSC_COMM_SELF,
"\tres_lambda = %6.4e lambda_int = %6.4e s = %6.4e\n",
184 case CTX_SNESSETJACOBIAN: {
200 case CTX_SNESSETJACOBIAN: {
203 PetscPrintf(PETSC_COMM_WORLD,
"\tdiag = %6.4e\n",
arcPtr->dIag);
220 if(
arcPtr->getPetscLocalDofIdx()!=-1) {
224 array[
arcPtr->getPetscLocalDofIdx()] = 0;
232 PetscPrintf(PETSC_COMM_WORLD,
"\tdlambda = %6.4e dx2 = %6.4e\n",
arcPtr->dLambda,
arcPtr->dx2);
242 "\tInit dlambda = %6.4e s = %6.4e beta = %6.4e F_lambda2 = %6.4e\n",
247 std::ostringstream sss;
249 SETERRQ(PETSC_COMM_SELF,1,sss.str().c_str());
258 if(
arcPtr->getPetscLocalDofIdx()!=-1) {
261 double lambda_old = array[
arcPtr->getPetscLocalDofIdx()];
262 if(!(dlambda == dlambda)) {
263 std::ostringstream sss;
265 SETERRQ(PETSC_COMM_SELF,1,sss.str().c_str());
267 array[
arcPtr->getPetscLocalDofIdx()] = lambda_old + dlambda;
268 PetscPrintf(PETSC_COMM_WORLD,
"\tlambda = %6.4e, %6.4e (%6.4e)\n",
269 lambda_old, array[
arcPtr->getPetscLocalDofIdx()], dlambda);