48void Foam::block::createPoints()
81 for (label
k=0;
k<=nk;
k++)
83 for (label j=0; j<=nj; j++)
85 for (label i=0; i<=ni; i++)
95 scalar wx1 = (1 -
w0)*(1 -
w4)*(1 -
w8) +
w0*(1 -
w5)*(1 -
w9);
100 const scalar sumWx = wx1 + wx2 + wx3 + wx4;
108 scalar wy1 = (1 -
w4)*(1 -
w0)*(1 -
w8) +
w4*(1 -
w1)*(1 -
w11);
113 const scalar sumWy = wy1 + wy2 + wy3 + wy4;
121 scalar wz1 = (1 -
w8)*(1 -
w0)*(1 -
w4) +
w8*(1 -
w3)*(1 -
w7);
126 const scalar sumWz = wz1 + wz2 + wz3 + wz4;
134 const vector edgex1 = p000 + (p100 - p000)*
w0;
135 const vector edgex2 = p010 + (p110 - p010)*
w1;
136 const vector edgex3 = p011 + (p111 - p011)*
w2;
137 const vector edgex4 = p001 + (p101 - p001)*
w3;
139 const vector edgey1 = p000 + (p010 - p000)*
w4;
140 const vector edgey2 = p100 + (p110 - p100)*
w5;
141 const vector edgey3 = p101 + (p111 - p101)*
w6;
142 const vector edgey4 = p001 + (p011 - p001)*
w7;
144 const vector edgez1 = p000 + (p001 - p000)*
w8;
145 const vector edgez2 = p100 + (p101 - p100)*
w9;
146 const vector edgez3 = p110 + (p111 - p110)*
w10;
147 const vector edgez4 = p010 + (p011 - p010)*
w11;
152 wx1*edgex1 + wx2*edgex2 + wx3*edgex3 + wx4*edgex4
153 + wy1*edgey1 + wy2*edgey2 + wy3*edgey3 + wy4*edgey4
154 + wz1*edgez1 + wz2*edgez2 + wz3*edgez3 + wz4*edgez4
162 const vector corx1 = wx1*(
p[0][i] - edgex1);
163 const vector corx2 = wx2*(
p[1][i] - edgex2);
164 const vector corx3 = wx3*(
p[2][i] - edgex3);
165 const vector corx4 = wx4*(
p[3][i] - edgex4);
167 const vector cory1 = wy1*(
p[4][j] - edgey1);
168 const vector cory2 = wy2*(
p[5][j] - edgey2);
169 const vector cory3 = wy3*(
p[6][j] - edgey3);
170 const vector cory4 = wy4*(
p[7][j] - edgey4);
172 const vector corz1 = wz1*(
p[8][
k] - edgez1);
173 const vector corz2 = wz2*(
p[9][
k] - edgez2);
174 const vector corz3 = wz3*(
p[10][
k] - edgez3);
175 const vector corz4 = wz4*(
p[11][
k] - edgez4);
179 corx1 + corx2 + corx3 + corx4
180 + cory1 + cory2 + cory3 + cory4
181 + corz1 + corz2 + corz3 + corz4
195 for (label ii=0; ii<=ni; ii++)
198 const label i = (ii + 1)%(ni + 1);
200 for (label j=0; j<=nj; j++)
202 for (label
k=0;
k<=nk;
k++)
211 (1 -
w0)*(1 -
w4)*(1 -
w8)
225 const scalar sumWf = wf0 + wf1;
247 for (label jj=0; jj<=nj; jj++)
250 const label j = (jj + 1)%(nj + 1);
252 for (label i=0; i<=ni; i++)
254 for (label
k=0;
k<=nk;
k++)
263 (1 -
w4)*(1 -
w1)*(1 -
w8)
277 const scalar sumWf = wf2 + wf3;
299 for (label kk=0; kk<=nk; kk++)
302 const label
k = (kk + 1)%(nk + 1);
304 for (label i=0; i<=ni; i++)
306 for (label j=0; j<=nj; j++)
315 (1 -
w8)*(1 -
w0)*(1 -
w4)
329 const scalar sumWf = wf4 + wf5;
352void Foam::block::createCells()
354 const label ni = density().x();
355 const label nj = density().y();
356 const label nk = density().z();
358 blockCells_.resize(nCells());
362 for (label
k=0;
k<nk; ++
k)
364 for (label j=0; j<nj; ++j)
366 for (label i=0; i<ni; ++i)
368 blockCells_[celli] = vertLabels(i, j,
k);
376template<
class OutputIterator>
377OutputIterator Foam::block::addBoundaryFaces
383 const label ni = density().x();
384 const label nj = density().y();
385 const label nk = density().z();
392 for (label
k=0;
k<nk; ++
k)
394 for (label j=0; j<nj; ++j)
400 f[0] = pointLabel(0, j,
k);
401 f[1] = pointLabel(0, j,
k+1);
402 f[2] = pointLabel(0, j+1,
k+1);
403 f[3] = pointLabel(0, j+1,
k);
412 for (label
k=0;
k<nk; ++
k)
414 for (label j=0; j<nj; ++j)
420 f[0] = pointLabel(ni, j,
k);
421 f[1] = pointLabel(ni, j+1,
k);
422 f[2] = pointLabel(ni, j+1,
k+1);
423 f[3] = pointLabel(ni, j,
k+1);
432 for (label i=0; i<ni; ++i)
434 for (label
k=0;
k<nk; ++
k)
440 f[0] = pointLabel(i, 0,
k);
441 f[1] = pointLabel(i+1, 0,
k);
442 f[2] = pointLabel(i+1, 0,
k+1);
443 f[3] = pointLabel(i, 0,
k+1);
452 for (label i=0; i<ni; ++i)
454 for (label
k=0;
k<nk; ++
k)
460 f[0] = pointLabel(i, nj,
k);
461 f[1] = pointLabel(i, nj,
k+1);
462 f[2] = pointLabel(i+1, nj,
k+1);
463 f[3] = pointLabel(i+1, nj,
k);
472 for (label i=0; i<ni; ++i)
474 for (label j=0; j<nj; ++j)
480 f[0] = pointLabel(i, j, 0);
481 f[1] = pointLabel(i, j+1, 0);
482 f[2] = pointLabel(i+1, j+1, 0);
483 f[3] = pointLabel(i+1, j, 0);
492 for (label i=0; i<ni; ++i)
494 for (label j=0; j<nj; ++j)
500 f[0] = pointLabel(i, j, nk);
501 f[1] = pointLabel(i+1, j, nk);
502 f[2] = pointLabel(i+1, j+1, nk);
503 f[3] = pointLabel(i, j+1, nk);
514void Foam::block::createBoundary()
516 const label countx = (density().y() * density().z());
517 const label county = (density().z() * density().x());
518 const label countz = (density().x() * density().y());
523 blockPatches_[patchi].resize(countx);
524 addBoundaryFaces(patchi, blockPatches_[patchi].
begin());
528 blockPatches_[patchi].resize(countx);
529 addBoundaryFaces(patchi, blockPatches_[patchi].
begin());
533 blockPatches_[patchi].resize(county);
534 addBoundaryFaces(patchi, blockPatches_[patchi].
begin());
538 blockPatches_[patchi].resize(county);
539 addBoundaryFaces(patchi, blockPatches_[patchi].
begin());
543 blockPatches_[patchi].resize(countz);
544 addBoundaryFaces(patchi, blockPatches_[patchi].
begin());
548 blockPatches_[patchi].resize(countz);
549 addBoundaryFaces(patchi, blockPatches_[patchi].
begin());
558 const label ni = density().x();
559 const label nj = density().y();
560 const label nk = density().z();
566 for (label
k=0;
k<nk; ++
k)
568 for (label j=0; j<nj; ++j)
570 for (label i=0; i<ni; ++i)
572 theCells[celli] = vertLabels(i, j,
k).shape();
void resize(const label len)
Adjust allocated size of list.
const Cmpt & z() const
Access to the vector z component.
const Cmpt & y() const
Access to the vector y component.
const Cmpt & x() const
Access to the vector x component.
label nCurvedFaces() const noexcept
Number of curved faces in this block.
bool flatFaceOrEdge(const label i, const label j, const label k) const
Return true if point i,j,k addresses a block flat face or edge.
const point & blockPoint(const label i) const
Return block point for local label i.
bool vertex(const label i, const label j, const label k) const
True if point i,j,k addresses a block vertex.
int edgesPointsWeights(pointField(&edgesPoints)[12], scalarList(&edgesWeights)[12]) const
Calculate the points and weights for all edges.
label facePointLabel(const direction facei, const label i, const label j) const
const labelVector & density() const noexcept
The mesh density (number of cells) in the i,j,k directions.
void correctFacePoints(FixedList< pointField, 6 > &) const
Correct the location of the given face-points.
FixedList< pointField, 6 > facePoints(const pointField &points) const
Return the list of face-points for all of the faces of the block.
cellShapeList shapes() const
The (hex) cell shapes for filling the block.
label pointLabel(const label i, const label j, const label k) const
The linear point index for an i-j-k position.
label nPoints() const
The number of mesh points (nx+1)*(ny+1)*(nz+1) in the i-j-k mesh.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
vectorField pointField
pointField is a vectorField.
List< scalar > scalarList
A List of scalars.
vector point
Point is a vector.
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.