Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order nodes counterclockwise for each face in Draco_Mesh::Layout. #550

Merged
merged 1 commit into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions src/mesh/Draco_Mesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ std::vector<std::vector<double>> Draco_Mesh::compute_node_coord_vec(
* \param[in] cell_to_node_linkage serial map of cell index to node indices.
* \param[in] side_node_count number of verices per side.
* \param[in] side_to_node_linkage serial map of side index to node indices.
* \param[in] ghost_cell_type help me
* \param[in] ghost_cell_to_node_linkage help me
* \param[in] ghost_cell_type number of common vertices per ghost cell.
* \param[in] ghost_cell_to_node_linkage vertices in common per ghost cell.
*/
void Draco_Mesh::compute_cell_to_cell_linkage(
const std::vector<unsigned> &cell_type,
Expand Down Expand Up @@ -193,27 +193,22 @@ void Draco_Mesh::compute_cell_to_cell_linkage(

// create a vector of all possible node pairs
unsigned nper_cell = cell_type[cell];
unsigned num_pairs = nper_cell * (nper_cell - 1) / 2;
std::vector<std::vector<unsigned>> vec_node_vec(num_pairs,
std::vector<std::vector<unsigned>> vec_node_vec(nper_cell,
std::vector<unsigned>(2));
// \todo: change type of vec_node_vec?
unsigned k = 0;
// this assumes counter-clockwise cell-node linkage
for (unsigned i = 0; i < nper_cell; ++i) {
for (unsigned j = i + 1; j < nper_cell; ++j) {

// set kth pair entry to the size 2 vector of nodes
vec_node_vec[k] = {cell_to_node_linkage[node_offset + i],
cell_to_node_linkage[node_offset + j]};
// next cell-local node
const unsigned j = (i + 1) % nper_cell;

// increment k
k++;
}
// set ith pair entry to the size 2 vector of nodes
vec_node_vec[i] = {cell_to_node_linkage[node_offset + i],
cell_to_node_linkage[node_offset + j]};
}

Check(k == num_pairs);

// check if each pair constitutes a face
for (unsigned l = 0; l < num_pairs; ++l) {
for (unsigned l = 0; l < nper_cell; ++l) {

// get adjacent cells from node-to-cell map
// \todo: add DbC to ensure these are sorted
Expand Down
2 changes: 1 addition & 1 deletion src/mesh/Draco_Mesh.hh
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ private:
std::vector<std::vector<double>>
compute_node_coord_vec(const std::vector<double> &coordinates) const;

//! Calculate the cell-to-cell linkage (layout)
// \todo: add layout class and complete temporary version of this function.
//! Calculate the cell-to-cell linkage (layout)
void compute_cell_to_cell_linkage(
const std::vector<unsigned> &cell_type,
const std::vector<unsigned> &cell_to_node_linkage,
Expand Down
2 changes: 1 addition & 1 deletion src/mesh/X3D_Draco_Mesh_Reader.i.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace rtt_mesh {
* \brief Generate a map from a block in an x3d file
*
* \param[in] block_name name of parsed x3d block
* \param[in] dist help me
* \param[in] dist number of string-pairs to skip when looking for an x3d block
*
* \return map of mesh data with key of type KT and value of type VT
*/
Expand Down