@@ -77,31 +77,13 @@ Data& Data::WithPartitions(std::vector<std::vector<Index>> const& partitionsIn)
77
77
return *this ;
78
78
}
79
79
80
- Data& Data::WithDirichletConstrainedVertices (
81
- IndexVectorX const & dbcIn,
82
- bool bDbcSorted,
83
- bool bPartitionsSorted)
80
+ Data& Data::WithDirichletConstrainedVertices (IndexVectorX const & dbcIn, bool bDbcSorted)
84
81
{
85
82
this ->dbc = dbcIn;
86
83
if (not bDbcSorted)
87
84
{
88
85
std::sort (this ->dbc .begin (), this ->dbc .end ());
89
86
}
90
- for (auto & partition : partitions)
91
- {
92
- std::vector<Index> freePartition = partition;
93
- if (not bPartitionsSorted)
94
- {
95
- std::sort (partition.begin (), partition.end ());
96
- }
97
- std::set_difference (
98
- partition.begin (),
99
- partition.end (),
100
- this ->dbc .begin (),
101
- this ->dbc .end (),
102
- freePartition.begin ());
103
- std::swap (partition, freePartition);
104
- }
105
87
return *this ;
106
88
}
107
89
@@ -131,7 +113,6 @@ Data& Data::WithHessianDeterminantZeroUnder(Scalar zero)
131
113
132
114
Data& Data::Construct (bool bValidate)
133
115
{
134
- // clang-format off
135
116
if (xt.size () == 0 )
136
117
{
137
118
xt = x;
@@ -160,8 +141,25 @@ Data& Data::Construct(bool bValidate)
160
141
lame.row (0 ).setConstant (mu);
161
142
lame.row (1 ).setConstant (lambda);
162
143
}
144
+ // Constrained vertices must not move
145
+ v (Eigen::all, dbc).setZero ();
146
+ aext (Eigen::all, dbc).setZero ();
147
+ for (auto & partition : partitions)
148
+ {
149
+ std::vector<Index> freePartition = partition;
150
+ std::sort (partition.begin (), partition.end ());
151
+ std::set_difference (
152
+ partition.begin (),
153
+ partition.end (),
154
+ this ->dbc .begin (),
155
+ this ->dbc .end (),
156
+ freePartition.begin ());
157
+ std::swap (partition, freePartition);
158
+ }
159
+
163
160
if (bValidate)
164
161
{
162
+ // clang-format off
165
163
bool const bPerVertexQuantityDimensionsValid =
166
164
x.cols () == xt.cols () and
167
165
x.cols () == v.cols () and
0 commit comments