Skip to content
Snippets Groups Projects
Commit 4a973e02 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Get ride of Connectivity::invCellNbNodes()

This was a marginal optimization that
- is too specific (was used only once ...)
- generate no measurable performance change
parent d3adc9e5
No related branches found
No related tags found
1 merge request!133Simplify access functions to the number of items
......@@ -103,8 +103,6 @@ class Connectivity final : public IConnectivity
std::vector<RefEdgeList> m_ref_edge_list_vector;
std::vector<RefNodeList> m_ref_node_list_vector;
WeakCellValue<const double> m_inv_cell_nb_nodes;
void _computeCellFaceAndFaceNodeConnectivities();
void _buildIsBoundaryFace() const;
......@@ -685,24 +683,6 @@ class Connectivity final : public IConnectivity
}
}
CellValue<const double>
invCellNbNodes() const
{
if (not m_inv_cell_nb_nodes.isBuilt()) {
const auto& cell_to_node_matrix = m_item_to_item_matrix[itemTId(ItemType::cell)][itemTId(ItemType::node)];
WeakCellValue<double> inv_cell_nb_nodes(*this);
parallel_for(
this->numberOfCells(), PUGS_LAMBDA(CellId j) {
const auto& cell_nodes = cell_to_node_matrix.rowConst(j);
inv_cell_nb_nodes[j] = 1. / cell_nodes.length;
});
const_cast<WeakCellValue<const double>&>(m_inv_cell_nb_nodes) = inv_cell_nb_nodes;
}
return m_inv_cell_nb_nodes;
}
Connectivity(const Connectivity&) = delete;
private:
......
......@@ -174,8 +174,6 @@ class MeshData : public IMeshData
} else {
const NodeValue<const Rd>& xr = m_mesh.xr();
const CellValue<const double>& inv_cell_nb_nodes = m_mesh.connectivity().invCellNbNodes();
const auto& cell_to_node_matrix = m_mesh.connectivity().cellToNodeMatrix();
CellValue<Rd> cell_iso_barycenter{m_mesh.connectivity()};
parallel_for(
......@@ -185,7 +183,7 @@ class MeshData : public IMeshData
for (size_t R = 0; R < cell_nodes.size(); ++R) {
X += xr[cell_nodes[R]];
}
cell_iso_barycenter[j] = inv_cell_nb_nodes[j] * X;
cell_iso_barycenter[j] = (1. / cell_nodes.size()) * X;
});
m_cell_iso_barycenter = cell_iso_barycenter;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment