MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / getBdAreaMatrix

Method getBdAreaMatrix

tools/Assembler/ref/Assembler.cpp:31–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31ZSparseMatrix Assembler::getBdAreaMatrix() {
32 typedef Eigen::Triplet<double> T;
33 std::vector<T> triplets;
34 size_t dim = getDim();
35
36 size_t num_bd_vertices = m_mesh->getNbrBoundaryNodes();
37 for (size_t i=0; i<num_bd_vertices; i++) {
38 VectorI bd_faces = m_mesh->getBoundaryNodeAdjacentBoundaryFaces(i);
39 double area = 0.0;
40 for (size_t j=0; j<bd_faces.size(); j++) {
41 area += m_mesh->getBoundaryFaceArea(bd_faces[j]);
42 }
43 area /= double(dim);
44 triplets.push_back(T(i, i, area));
45 }
46
47 Eigen::SparseMatrix<double> Pb = Eigen::SparseMatrix<double>(num_bd_vertices, num_bd_vertices);
48 Pb.setFromTriplets(triplets.begin(), triplets.end());
49 return ZSparseMatrix(Pb);
50}
51
52// Item is basically a <key, value> pair.
53typedef std::pair<int, double> Item;

Callers

nothing calls this directly

Calls 7

ZSparseMatrixClass · 0.50
getNbrBoundaryNodesMethod · 0.45
sizeMethod · 0.45
getBoundaryFaceAreaMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected