----------------------------------------------------------------------------
| 1734 | |
| 1735 | //---------------------------------------------------------------------------- |
| 1736 | void vtkFiniteElementFieldDistributor::vtkInternals::InterpolateCellToNodes(vtkIdType cellId, |
| 1737 | vtkCellArray* newCells, vtkPoints* newPoints, vtkCellData* oldCd, vtkPointData* hCurlFields, |
| 1738 | vtkPointData* hDivFields) |
| 1739 | { |
| 1740 | // we will interpolate onto the points found at new point ids. (from cell explosion) |
| 1741 | const vtkIdType* newPts = nullptr; |
| 1742 | vtkIdType newNpts = 0; |
| 1743 | newCells->GetCellAtId(cellId, newNpts, newPts); |
| 1744 | if (this->Vblps.RequiresInitialization(this->RefElement, newNpts)) |
| 1745 | { |
| 1746 | auto pCoords = this->GetLagrangePCoords(this->RefElement, newNpts); |
| 1747 | // for all others, need to shift center of element to (0,0,0) |
| 1748 | if (this->RefElement != VTK_TRIANGLE && this->RefElement != VTK_TETRA) |
| 1749 | { |
| 1750 | std::transform(pCoords.cbegin(), pCoords.cend(), pCoords.begin(), |
| 1751 | [](const double& val) -> double { return 2 * (val - 0.5); }); |
| 1752 | } |
| 1753 | this->Vblps.Initialize(this->RefElement, pCoords.data(), newNpts); |
| 1754 | this->CachedParametricCoordinates = pCoords; |
| 1755 | } |
| 1756 | this->Vblps.ComputeJacobian( |
| 1757 | this->RefElement, this->CachedParametricCoordinates.data(), newNpts, newPts, newPoints); |
| 1758 | |
| 1759 | for (const auto& fieldName : this->hCurlSpec().Fields) |
| 1760 | { |
| 1761 | std::vector<double> coeffs = ::GetEdgeAttributes(fieldName, oldCd, cellId); |
| 1762 | if (coeffs.empty()) |
| 1763 | { |
| 1764 | continue; |
| 1765 | } |
| 1766 | vtkDataArray* outArr = hCurlFields->GetArray(fieldName.c_str()); |
| 1767 | const auto refVblpMat = this->Vblps.GetVblp(::SpaceType::HCurl, this->RefElement); |
| 1768 | const auto jacMat = this->Vblps.GetJacobianMatrices(this->RefElement); |
| 1769 | if (refVblpMat != nullptr && jacMat != nullptr) |
| 1770 | { |
| 1771 | const auto physVblpMat = |
| 1772 | this->Vblps.ReferenceToPhysical(*refVblpMat, *jacMat, SpaceType::HCurl); |
| 1773 | ::InterpolateToNodes(physVblpMat, coeffs, newNpts, newPts, outArr); |
| 1774 | } |
| 1775 | } |
| 1776 | |
| 1777 | for (const auto& fieldName : this->hDivSpec().Fields) |
| 1778 | { |
| 1779 | std::vector<double> coeffs; |
| 1780 | if (this->RefElement == VTK_QUAD || this->RefElement == VTK_TRIANGLE) |
| 1781 | { |
| 1782 | coeffs = ::GetEdgeAttributes(fieldName, oldCd, cellId); |
| 1783 | } |
| 1784 | else |
| 1785 | { |
| 1786 | coeffs = ::GetFaceAttributes(fieldName, oldCd, cellId); |
| 1787 | } |
| 1788 | if (coeffs.empty()) |
| 1789 | { |
| 1790 | continue; |
| 1791 | } |
| 1792 | vtkDataArray* outArr = hDivFields->GetArray(fieldName.c_str()); |
| 1793 | const auto refVblpMat = this->Vblps.GetVblp(::SpaceType::HDiv, this->RefElement); |
no test coverage detected