MCPcopy Create free account
hub / github.com/Kitware/VTK / InterpolateCellToNodes

Method InterpolateCellToNodes

Filters/General/vtkFiniteElementFieldDistributor.cxx:1736–1802  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1734
1735//----------------------------------------------------------------------------
1736void 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);

Callers 1

RequestDataMethod · 0.80

Calls 15

GetLagrangePCoordsMethod · 0.95
GetEdgeAttributesFunction · 0.85
InterpolateToNodesFunction · 0.85
GetFaceAttributesFunction · 0.85
ComputeJacobianMethod · 0.80
GetVblpMethod · 0.80
GetJacobianMatricesMethod · 0.80
ReferenceToPhysicalMethod · 0.80
transformFunction · 0.50
GetCellAtIdMethod · 0.45
cbeginMethod · 0.45

Tested by

no test coverage detected