Skip to content

Commit 757e285

Browse files
committed
Fix Issue #951. apply clang-format
1 parent 9afcccf commit 757e285

File tree

3 files changed

+42
-36
lines changed

3 files changed

+42
-36
lines changed

mfront/include/MFront/GenericBehaviour/StandardFiniteStrainBehaviourIntegrate.hxx

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ namespace mfront::gb::finite_strain {
126126
reportError(d, "invalid choice for consistent tangent operator");
127127
return -1;
128128
}
129+
const auto bs = d.K[0] > 50;
130+
const auto Ke = bs ? d.K[0] - 100 : d.K[0];
129131
tfel::math::stensor<N, real> s0;
130132
tfel::math::stensor<N, real> s1;
131133
auto* const thermodynamic_forces0_old = d.s0.thermodynamic_forces;
@@ -163,45 +165,49 @@ namespace mfront::gb::finite_strain {
163165
reportError(d, "invalid choice for the stress measure");
164166
return -1;
165167
}
168+
s1 = s0;
166169
d.s0.thermodynamic_forces = s0.begin();
167170
d.s1.thermodynamic_forces = s1.begin();
168171
}
169172
const auto r = mfront::gb::integrate<Behaviour>(d, smf, p);
170173
d.s0.thermodynamic_forces = thermodynamic_forces0_old;
171174
d.s1.thermodynamic_forces = thermodynamic_forces1_old;
172-
if ((r) && (sm != StressMeasure::CAUCHY)) {
173-
tfel::math::tensor<N, real> F1;
174-
tfel::fsalgo::copy<TensorSize>::exe(d.s1.gradients, F1.begin());
175-
if constexpr ((hypothesis == ModellingHypothesis::PLANESTRESS) ||
176-
(hypothesis == ModellingHypothesis::
177-
AXISYMMETRICALGENERALISEDPLANESTRESS)) {
178-
if constexpr (Traits::has_axial_deformation_gradient_offset) {
179-
const auto F1zz = d.s1.internal_state_variables
180-
[Traits::axial_deformation_gradient_offset];
181-
if constexpr (hypothesis == ModellingHypothesis::PLANESTRESS) {
182-
F1[2] += F1zz;
175+
if (Ke > -0.25) { // not a prediction
176+
if ((r) && (sm != StressMeasure::CAUCHY)) {
177+
tfel::math::tensor<N, real> F1;
178+
tfel::fsalgo::copy<TensorSize>::exe(d.s1.gradients, F1.begin());
179+
if constexpr ((hypothesis == ModellingHypothesis::PLANESTRESS) ||
180+
(hypothesis ==
181+
ModellingHypothesis::
182+
AXISYMMETRICALGENERALISEDPLANESTRESS)) {
183+
if constexpr (Traits::has_axial_deformation_gradient_offset) {
184+
const auto F1zz = d.s1.internal_state_variables
185+
[Traits::axial_deformation_gradient_offset];
186+
if constexpr (hypothesis == ModellingHypothesis::PLANESTRESS) {
187+
F1[2] += F1zz;
188+
} else {
189+
F1[1] += F1zz;
190+
}
183191
} else {
184-
F1[1] += F1zz;
192+
reportError(d,
193+
"the axial deformation gradient is not defined "
194+
"as an internal state variable");
195+
return -1;
185196
}
197+
}
198+
if (sm == StressMeasure::PK1) {
199+
tfel::math::TensorView<N, real> pk1(d.s1.thermodynamic_forces);
200+
pk1 = tfel::math::convertCauchyStressToFirstPiolaKirchhoffStress(s1,
201+
F1);
202+
} else if (sm == StressMeasure::PK2) {
203+
tfel::math::StensorView<N, real> S1(d.s1.thermodynamic_forces);
204+
S1 = tfel::math::convertCauchyStressToSecondPiolaKirchhoffStress(s1,
205+
F1);
186206
} else {
187-
reportError(d,
188-
"the axial deformation gradient is not defined "
189-
"as an internal state variable");
207+
reportError(d, "invalid choice for the stress measure");
190208
return -1;
191209
}
192210
}
193-
if (sm == StressMeasure::PK1) {
194-
tfel::math::TensorView<N, real> pk1(d.s1.thermodynamic_forces);
195-
pk1 =
196-
tfel::math::convertCauchyStressToFirstPiolaKirchhoffStress(s1, F1);
197-
} else if (sm == StressMeasure::PK2) {
198-
tfel::math::StensorView<N, real> S1(d.s1.thermodynamic_forces);
199-
S1 =
200-
tfel::math::convertCauchyStressToSecondPiolaKirchhoffStress(s1, F1);
201-
} else {
202-
reportError(d, "invalid choice for the stress measure");
203-
return -1;
204-
}
205211
}
206212
return r;
207213
} // end of integrate

mfront/src/UMATInterfaceBase.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,7 @@ namespace mfront {
648648
out << " * \\param[in] " << iprefix << v.first << ": " << v.second
649649
<< "\n";
650650
}
651-
out << " */\n"
652-
<< mb.getClassName() << "BehaviourData(";
651+
out << " */\n" << mb.getClassName() << "BehaviourData(";
653652
if (pT != nullptr) {
654653
out << "const NumericType* const " << iprefix << "T_";
655654
} else {
@@ -751,7 +750,8 @@ namespace mfront {
751750
if (pT != nullptr) {
752751
out << " * \\param[in] " + iprefix + "dT_: temperature increment\n";
753752
} else {
754-
out << " * \\param[in] " + iprefix + "dT_: temperature increment (unused)\n";
753+
out << " * \\param[in] " + iprefix +
754+
"dT_: temperature increment (unused)\n";
755755
}
756756
}
757757
if (this->areExternalStateVariablesSupported()) {
@@ -776,9 +776,9 @@ namespace mfront {
776776
}
777777
}
778778
if (this->areExternalStateVariablesSupported()) {
779-
if (pT != nullptr){
779+
if (pT != nullptr) {
780780
this->checkIfTemperatureIsDefinedAsTheFirstExternalStateVariable(mb);
781-
out << ", const NumericType* const";
781+
out << ", const NumericType* const";
782782
if (externalStateVarsHolder.size() != 1) {
783783
out << " " << iprefix << "dext_vars";
784784
}

mtest/src/CastemModel.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ namespace mtest {
4545
this->mpnames.insert(this->mpnames.end(), mps.begin(), mps.end());
4646
//
4747
const bool isTemperatureAndExternalStateVariable =
48-
std::find(this->evnames.begin(), this->evnames.end(),
49-
"Temperature") != this->evnames.end();
48+
std::find(this->evnames.begin(), this->evnames.end(), "Temperature") !=
49+
this->evnames.end();
5050
if (isTemperatureAndExternalStateVariable) {
5151
if (this->evnames.at(0) != "Temperature") {
5252
tfel::raise(
@@ -151,8 +151,8 @@ namespace mtest {
151151
auto kinc = CastemInt{1};
152152
auto k = CastemReal{0};
153153
const bool isTemperatureAndExternalStateVariable =
154-
std::find(this->evnames.begin(), this->evnames.end(),
155-
"Temperature") != this->evnames.end();
154+
std::find(this->evnames.begin(), this->evnames.end(), "Temperature") !=
155+
this->evnames.end();
156156
if (isTemperatureAndExternalStateVariable) {
157157
(this->fct)(&s.s1(0), &wk.ivs(0), &k, nullptr, nullptr, nullptr, nullptr,
158158
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &dt,

0 commit comments

Comments
 (0)