Skip to content

Commit

Permalink
Merge pull request #234 from j8xixo12/fix_mesh
Browse files Browse the repository at this point in the history
Fix mesh
  • Loading branch information
yungyuc authored Sep 9, 2023
2 parents ecbffcc + 6dd41ed commit ff3bcaf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cpp/modmesh/mesh/StaticMesh_boundary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ inline void StaticMesh::fill_ghost()
}
for (size_t idm = 0; idm < m_ndim; ++idm)
{
m_ndcrd(igcl, idm) = m_ndcrd(icl, idm) + 2 * dist * m_fcnml(ibfc, idm);
m_ndcrd(ignd, idm) = m_ndcrd(ind, idm) + 2 * dist * m_fcnml(ibfc, idm);
}
// decrement ghost node counter.
ignd -= 1;
Expand Down
18 changes: 18 additions & 0 deletions cpp/modmesh/mesh/StaticMesh_interior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ struct FaceBuilder
using uint_type = typename number_base::uint_type;
using real_type = typename number_base::real_type;

size_t add_point(int_type icl, int_type ifc)
{
constexpr const size_t NFACE = 1;
clfcs(icl, 0) = NFACE;
for (size_t i = 0; i < NFACE; ++i)
{
fctpn(ifc + i) = CellType::NONCELLTYPE;
fcnds(ifc + i, 0) = 0; // number of nodes per face.
}
// face 1.
clfcs(icl, 1) = ifc;
fcnds(ifc, 1) = clnds(icl, 1);
return NFACE;
}

size_t add_line(int_type icl, int_type ifc)
{
constexpr const size_t NFACE = 2;
Expand Down Expand Up @@ -361,6 +376,9 @@ struct FaceBuilder
{
switch (cltpn(icl))
{
case CellType::POINT:
ifc += static_cast<int_type>(add_point(icl, ifc));
break;
case CellType::LINE:
ifc += static_cast<int_type>(add_line(icl, ifc));
break;
Expand Down

0 comments on commit ff3bcaf

Please sign in to comment.