26 double x = v->
x(), y = v->
y(),
z = v->
z();
27 double x0 = v0->
x(), y0 = v0->
y(), z0 = v0->
z();
28 double x1 = v1->
x(), y1 = v1->
y(), z1 = v1->
z();
29 if(fabs(x - x0) < tol && fabs(y - y0) < tol && fabs(
z - z0) < tol)
31 if(fabs(x - x1) < tol && fabs(y - y1) < tol && fabs(
z - z1) < tol)
33 if(x < x0 - tol || x > x1 + tol || y < std::min(y0, y1) - tol ||
34 y > std::max(y0, y1) + tol ||
z < std::min(z0, z1) - tol ||
35 z > std::max(z0, z1) + tol)
37 if(fabs(x1 - x0) > tol) {
38 double tx = (x - x0) / (x1 - x0);
39 if(fabs(y1 - y0) > tol) {
40 double ty = (y - y0) / (y1 - y0);
41 if(fabs(z1 - z0) > tol) {
42 double tz = (
z - z0) / (z1 - z0);
43 if(fabs(tx - ty) > tol || fabs(tx - tz) > tol)
return false;
46 if(fabs(tx - ty) > tol)
return false;
50 if(fabs(z1 - z0) > tol) {
51 double tz = (
z - z0) / (z1 - z0);
52 if(fabs(tx - tz) > tol)
return false;
57 if(fabs(y1 - y0) > tol) {
58 double ty = (y - y0) / (y1 - y0);
59 if(fabs(z1 - z0) > tol) {
60 double tz = (
z - z0) / (z1 - z0);
61 if(fabs(ty - tz) > tol)
return false;
69 std::vector<std::vector<MVertex *> > &vs)
72 if(e.empty())
return true;
75 for(
size_t i = 0; i < e.size(); i++) {
76 MVertex *v0 = e[i].getVertex(0);
77 MVertex *v1 = e[i].getVertex(1);
79 auto it0 =
c.find(v0), it1 =
c.find(v1);
81 c[v0] = std::make_pair(v1, (
MVertex *)
nullptr);
83 if(it0->second.second ==
nullptr) { it0->second.second = v1; }
85 Msg::Debug(
"A list of edges has points that are adjacent to 3 edges");
90 c[v1] = std::make_pair(v0, (
MVertex *)
nullptr);
92 if(it1->second.second ==
nullptr) { it1->second.second = v0; }
94 Msg::Debug(
"Wrong topology for a list of edges");
95 Msg::Debug(
"Node %d is adjacent to more than 2 nodes %d %d",
96 v1->
getNum(), it1->second.first->getNum(),
97 it1->second.second->getNum());
104 std::vector<MVertex *> v;
109 for(; it !=
c.end(); ++it) {
110 if(it->second.second ==
nullptr) {
117 auto its =
c.find(start);
120 (its->second.second == start) ? its->second.first : its->second.second;
128 v.push_back(current);
129 auto it =
c.find(current);
130 if(it ==
c.end() || it->first ==
nullptr) {
131 Msg::Error(
"Impossible to find %d", current->getNum());
134 MVertex *v1 = it->second.first;
135 MVertex *v2 = it->second.second;
146 if(current == start) { v.push_back(current); }
147 }
while(current != start && current !=
nullptr);
148 if(v.size() > 2 && v[v.size() - 2] == v[v.size() - 1]) {
149 v.erase(v.begin() + v.size() - 1);
159 for(std::size_t i = 0; i < v.size(); i++)
_v[i] = v[i];
172 double x = 0, y = 0,
z = 0;
174 x +=
f[i] *
_v[i]->x();
175 y +=
f[i] *
_v[i]->y();
176 z +=
f[i] *
_v[i]->z();
189 double dx = 0, dy = 0, dz = 0;
191 dx += sf[i][0] *
_v[i]->x();
192 dy += sf[i][0] *
_v[i]->y();
193 dz += sf[i][0] *
_v[i]->z();
208 sum +=
f[i] * val[k];