diff --git a/Numeric/cartesian.h b/Numeric/cartesian.h index 09c6bc6904a051588221bde2599d9077615a1e8f..9fd1cf5cee2d07ec491d71aa1e7d96adf0b50404 100644 --- a/Numeric/cartesian.h +++ b/Numeric/cartesian.h @@ -40,7 +40,7 @@ class cartesianBox { // set of active cells; the value stored for cell (i,j,k) is the // linear index (i + _Nxi * j + _Nxi *_Neta * k) std::set<int> _activeCells; - // map of stored nodal values, index by the linear index (i + + // map of stored nodal values, indexed by the linear index (i + // (_Nxi+1) * j + (_Nxi+1) * (_Neta+1) * k). Along with the value is // stored a node tag (used for global numbering of the nodes across // the grid levels) @@ -48,7 +48,7 @@ class cartesianBox { // level of the box (coarset box has highest level; finest box has // level==1) int _level; - // pointer to a finer (refined by 2) level box (if any) + // pointer to a finer (refined by 2) level box, if any cartesianBox<scalar> *_childBox; int _getNumNodes() { @@ -82,16 +82,15 @@ class cartesianBox { int i, j, k; getCellIJK(*it, i, j, k); if(!simplex){ - fprintf(f, "%d 5 3 1 1 1", num++); - fprintf(f, " %d", std::abs(getNodeTag(getNodeIndex(i, j, k)))); - fprintf(f, " %d", std::abs(getNodeTag(getNodeIndex(i + 1, j, k)))); - fprintf(f, " %d", std::abs(getNodeTag(getNodeIndex(i + 1, j + 1, k)))); - fprintf(f, " %d", std::abs(getNodeTag(getNodeIndex(i, j + 1, k)))); - fprintf(f, " %d", std::abs(getNodeTag(getNodeIndex(i, j, k + 1)))); - fprintf(f, " %d", std::abs(getNodeTag(getNodeIndex(i + 1, j, k + 1)))); - fprintf(f, " %d", std::abs(getNodeTag(getNodeIndex(i + 1, j + 1, k + 1)))); - fprintf(f, " %d", std::abs(getNodeTag(getNodeIndex(i, j + 1, k + 1)))); - fprintf(f, "\n"); + fprintf(f, "%d 5 3 1 1 1 %d %d %d %d %d %d %d %d\n", num++, + std::abs(getNodeTag(getNodeIndex(i, j, k))), + std::abs(getNodeTag(getNodeIndex(i + 1, j, k))), + std::abs(getNodeTag(getNodeIndex(i + 1, j + 1, k))), + std::abs(getNodeTag(getNodeIndex(i, j + 1, k))), + std::abs(getNodeTag(getNodeIndex(i, j, k + 1))), + std::abs(getNodeTag(getNodeIndex(i + 1, j, k + 1))), + std::abs(getNodeTag(getNodeIndex(i + 1, j + 1, k + 1))), + std::abs(getNodeTag(getNodeIndex(i, j + 1, k + 1)))); } else{ int idx[6][4] = { @@ -165,7 +164,7 @@ class cartesianBox { if(it != _nodalValues.end()) values.push_back(it->second.first); else{ - Msg::Error("Could not find value i,j,k=%d,%d,%d for cell %d\n", + Msg::Error("Could not find value i,j,k=%d,%d,%d for cell %d", i + I, j + J, k + K, t); values.push_back(0.); } diff --git a/utils/api_demos/mainCartesian.cpp b/utils/api_demos/mainCartesian.cpp index cc8a8d0c8f8bce00260832c0f9f51ac2b240fec8..fb1c825b5734cde5a79ab715ca957de9a20713a6 100644 --- a/utils/api_demos/mainCartesian.cpp +++ b/utils/api_demos/mainCartesian.cpp @@ -1,3 +1,11 @@ +// lx ly lz rmax levels +// +// plaqueEp.stp 0.2 0.2 0.2 0.3 3 +// plaqueEpRotated.stp 0.3 0.3 0.3 0.3 3 +// jonction_collee2.stp 6 6 6 10 3 +// panneau_raidi_simple.stp 3 3 50 10 1 +// plaque_trouee.stp 1 1 1 2 3 + #include "Gmsh.h" #include "GModel.h" #include "MVertex.h" @@ -184,10 +192,12 @@ int main(int argc,char *argv[]) double rmax = atof(argv[5]); int levels = (argc > 6) ? atof(argv[6]) : 1; - // minimum distance between points in the cloud at the coarsest level + // minimum distance between points in the cloud at the coarsest + // level double sampling = std::min(rmax, std::min(lx, std::min(ly, lz))); - // radius of the "tube" created around edges at the coarsest level + // radius of the "tube" created around parts to refine at the + // coarsest level double rtube = std::max(lx, std::max(ly, lz)) * 2.; GModel *gm = GModel::current(); @@ -270,7 +280,8 @@ int main(int argc,char *argv[]) Msg::Info("Renumbering mesh vertices across levels"); box.renumberNodes(); - box.writeMSH("yeah.msh", true); + bool decomposeInSimplex = false; + box.writeMSH("yeah.msh", decomposeInSimplex); Msg::Info("Done!"); GmshFinalize();