58 if(it->second.second > 0) n++;
65 if(it->second.second > 0) {
67 fprintf(
f,
"%d %g %g %g\n", it->second.second, p.
x(), p.
y(), p.
z());
74 int coeff = simplex ? 6 : 1;
81 int num = startingNum;
86 fprintf(
f,
"%d 5 3 1 1 1 %d %d %d %d %d %d %d %d\n", num++,
110 for(
int ii = 0; ii < 6; ii++) {
112 f,
"%d 4 3 1 1 1 %d %d %d %d\n", num++,
123 if(it->second.second > 0)
124 fprintf(
f,
"%d %g\n", it->second.second, it->second.first);
132 int Nzeta,
int level = 1)
142 X0, Y0, Z0, dxi, deta, dzeta, 2 * Nxi, 2 * Neta, 2 * Nzeta, level - 1);
153 typedef typename std::map<int, std::pair<scalar, int> >::iterator
valIter;
161 for(
int I = 0; I < 2; I++)
162 for(
int J = 0; J < 2; J++)
163 for(
int K = 0; K < 2; K++) {
166 values.push_back(it->second.first);
168 Msg::Error(
"Could not find value i,j,k=%d,%d,%d for cell %d", i + I,
170 values.push_back(0.);
192 return _childBox->getValueContainingPoint(x, y,
z);
194 return _childBox->getValueContainingPoint(x, y,
z);
196 return _childBox->getValueContainingPoint(x, y,
z);
198 return _childBox->getValueContainingPoint(x, y,
z);
200 return _childBox->getValueContainingPoint(x, y,
z);
202 return _childBox->getValueContainingPoint(x, y,
z);
204 return _childBox->getValueContainingPoint(x, y,
z);
206 return _childBox->getValueContainingPoint(x, y,
z);
209 vals[0] = it1->second.first;
210 vals[1] = it2->second.first;
211 vals[2] = it3->second.first;
212 vals[3] = it4->second.first;
213 vals[4] = it5->second.first;
214 vals[5] = it6->second.first;
215 vals[6] = it7->second.first;
216 vals[7] = it8->second.first;
239 double xyz[3] = {x, y,
z};
242 double val = newElem->
interpolate(vals, uvw[0], uvw[1], uvw[2]);
303 return it->second.second;
317 i = (index - k * ((
_nxi + 1) * (
_neta + 1)) - j * (
_nxi + 1));
325 for(
int I = 0; I < 2; I++)
326 for(
int J = 0; J < 2; J++)
327 for(
int K = 0; K < 2; K++)
329 std::pair<scalar, int>(0., 0);
335 int num = startingNum;
339 if(!parent || i % 2 || j % 2 || k % 2)
340 it->second.second = num++;
342 int tag = parent->getNodeTag(parent->getNodeIndex(i / 2, j / 2, k / 2));
344 it->second.second = num++;
346 it->second.second = -std::abs(tag);
351 void writeMSH(
const std::string &fileName,
bool simplex =
false,
352 bool writeNodalValues =
true)
354 FILE *
f = fopen(fileName.c_str(),
"w");
356 Msg::Error(
"Could not open file '%s'", fileName.c_str());
360 Msg::Info(
"Writing '%s' (%d nodes, %d elements)", fileName.c_str(),
361 numNodes, numElements);
362 fprintf(
f,
"$MeshFormat\n2.1 0 8\n$EndMeshFormat\n");
363 fprintf(
f,
"$Nodes\n%d\n", numNodes);
365 fprintf(
f,
"$EndNodes\n");
366 fprintf(
f,
"$Elements\n%d\n", numElements);
368 fprintf(
f,
"$EndElements\n");
369 if(writeNodalValues) {
370 fprintf(
f,
"$NodeData\n1\n\"distance\"\n1\n0.0\n3\n0\n1\n%d\n", numNodes);
372 fprintf(
f,
"$EndNodeData\n");