Skip to content
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
2 changes: 1 addition & 1 deletion smooth3D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ add_library(smooth3D ${SMOOTH3D_HEADER_FILES} ${SMOOTH3D_SRC_FILES})
#target_compile_features(gmds PUBLIC cxx_std_11)


target_link_libraries(smooth3D PRIVATE gmds)
target_link_libraries(smooth3D PRIVATE GMDSIg)
target_link_libraries(smooth3D PRIVATE Lima::Lima Mesquite::Mesquite)
target_link_libraries(smooth3D PUBLIC MachineTypes::MachineTypes)

Expand Down
1 change: 1 addition & 0 deletions smooth3D/inc/smooth3D/smooth3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ int S3_ConditionNumber2D(int_type nb_cells, int_type nb_nodes,
double *y, double *z, const double * weights, const double * relax,
int_type n_iter);

// S3_GETMe2D is no longer available.
int S3_GETMe2D(const double alpha, const double beta, int_type nb_cells,
int_type nb_nodes, const int_type * nb_nodes_per_cell,
const int_type *nodes_number, double *x, double *y, double *z,
Expand Down
33 changes: 20 additions & 13 deletions smooth3D/src/getme/GetMe2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
#include <cstdlib> // pour rand

#include "smooth3D/smooth.h"
#include <GMDS/IG/IGMesh.h>
#include <GMDS/IG/IGMeshDoctor.h>
#include <gmds/ig/Mesh.h>
#include <gmds/ig/MeshDoctor.h>

#include "math/Real3.h"
#include "math/MeanRatio.h"

// Fonction sp�cialis�e pour calculer le meanRatio pour un triangle
/*
// Fonction sp�cialis�e pour calculer le meanRatio pour un triangle
static Smooth3D::Real computeMeanRatio(gmds::Node& n0, gmds::Node& n1,
gmds::Node& n2) {
Smooth3D::Real3 p[3];
Expand All @@ -39,7 +40,7 @@ static Smooth3D::Real computeMeanRatio(gmds::Node& n0, gmds::Node& n1,
return (mean_ratio);
}

// Fonction sp�cialis�e pour calculer le meanRatio pour un quadrilat�re
// Fonction sp�cialis�e pour calculer le meanRatio pour un quadrilat�re
static Smooth3D::Real computeMeanRatio(gmds::Node& n0, gmds::Node& n1,
gmds::Node& n2, gmds::Node& n3) {
static const int kTriQuads[4][3] = { { 0, 1, 3 }, { 1, 2, 0 }, { 2, 3, 1 }, {
Expand Down Expand Up @@ -225,11 +226,11 @@ static FourNodes computeGetMeQuadrangle3D(gmds::Face& face,
return compute_nodes;
}

static void computeN2N(gmds::IGMesh& mesh) {
static void computeN2N(gmds::Mesh& mesh) {

std::map<gmds::TCellID, std::set<gmds::TCellID> > n2n;

gmds::IGMesh::face_iterator it_faces = mesh.faces_begin();
gmds::Mesh::face_iterator it_faces = mesh.faces_begin();

while (!it_faces.isDone()) {
gmds::Face f = it_faces.value();
Expand All @@ -255,14 +256,17 @@ static void computeN2N(gmds::IGMesh& mesh) {
current_node.set<gmds::Node>(adj_nodes);
}
}

*/

extern "C" int S3_GETMe2D(const double alpha, const double beta,
int_type nb_cells, int_type nb_nodes, const int_type * nb_nodes_per_cell,
const int_type *nodes_number, double *x, double *y, double *z,
const double * weights, const double * relax, int_type n_iter) {
std::cerr<<"S3_GETMe2D is no longer available."<<std::endl;
return -1;
/*
const int kTGMDSMask = gmds::DIM3 | gmds::N | gmds::F | gmds::F2N | gmds::N2N;
gmds::IGMesh internal_mesh(kTGMDSMask);
gmds::Mesh internal_mesh(kTGMDSMask);

gmds::Node* temp_array_nodes = new gmds::Node[nb_nodes];

Expand All @@ -284,7 +288,7 @@ extern "C" int S3_GETMe2D(const double alpha, const double beta,
internal_mesh.newFace(nodes_cell);
}

gmds::IGMeshDoctor mesh_doc(&internal_mesh);
gmds::MeshDoctor mesh_doc(&internal_mesh);
mesh_doc.updateUpwardConnectivity();
computeN2N(internal_mesh);

Expand Down Expand Up @@ -312,7 +316,7 @@ extern "C" int S3_GETMe2D(const double alpha, const double beta,
weights_pos[vtx] = 0.0;
}

for (gmds::IGMesh::face_iterator it = internal_mesh.faces_begin();
for (gmds::Mesh::face_iterator it = internal_mesh.faces_begin();
!it.isDone(); it.next()) {
gmds::Face current_face = it.value();

Expand Down Expand Up @@ -417,14 +421,16 @@ delete[] new_pos;
delete[] temp_array_nodes;

return (0);
*/
}

/*
void testGetMeUnitTri(void) {
Smooth3D::Real theta = M_PI / 6.0;
Smooth3D::Real lambda = 0.0;

const int kTGmdsMask = gmds::DIM3 | gmds::N | gmds::F | gmds::F2N;
gmds::IGMesh internal_mesh(kTGmdsMask);
gmds::Mesh internal_mesh(kTGmdsMask);

// we start with a square triangle
gmds::Node noeuds[3];
Expand Down Expand Up @@ -462,7 +468,7 @@ Smooth3D::Real theta = M_PI / 6.0;
Smooth3D::Real lambda = 0.25;

const int kTGMDSMask = gmds::DIM3 | gmds::N | gmds::F | gmds::F2N;
gmds::IGMesh internal_mesh(kTGMDSMask);
gmds::Mesh internal_mesh(kTGMDSMask);

// we start with a square triangle
gmds::Node noeuds[4];
Expand Down Expand Up @@ -502,7 +508,7 @@ Smooth3D::Real theta = M_PI / 6.0;
Smooth3D::Real lambda = 0.25;

const int kTGMDSMask = gmds::DIM3 | gmds::N | gmds::F | gmds::F2N;
gmds::IGMesh internal_mesh(kTGMDSMask);
gmds::Mesh internal_mesh(kTGMDSMask);

// we start with a non convex quadrangle

Expand Down Expand Up @@ -538,3 +544,4 @@ for (int i = 0; i < 10; i++) {
}

}
*/
12 changes: 6 additions & 6 deletions smooth3D/src/opt2D/ObjectiveCondition2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ Real ObjectiveCondition2D::evalF(const Real3 & p) {

gmds::Node adj12, adj21, temp;
thisFace.getAdjacentNodes(adj1, adj12, temp);
if (temp.getID() != m_node.getID())
if (temp.id() != m_node.id())
adj12 = temp;
thisFace.getAdjacentNodes(adj2, adj21, temp);
if (temp.getID() != m_node.getID())
if (temp.id() != m_node.id())
adj21 = temp;

n12 = Real3(adj12.X(), adj12.Y(), adj12.Z());
Expand Down Expand Up @@ -69,10 +69,10 @@ void ObjectiveCondition2D::evalDF(const Real3 & p, Real3 & grad) {

gmds::Node adj12, adj21, temp;
thisFace.getAdjacentNodes(adj1, adj12, temp);
if (temp.getID() != m_node.getID())
if (temp.id() != m_node.id())
adj12 = temp;
thisFace.getAdjacentNodes(adj2, adj21, temp);
if (temp.getID() != m_node.getID())
if (temp.id() != m_node.id())
adj21 = temp;

n12 = Real3(adj12.X(), adj12.Y(), adj12.Z());
Expand All @@ -98,10 +98,10 @@ Real ObjectiveCondition2D::evalFDF(const Real3 & p, Real3 & grad) {

gmds::Node adj12, adj21, temp;
thisFace.getAdjacentNodes(adj1, adj12, temp);
if (temp.getID() != m_node.getID())
if (temp.id() != m_node.id())
adj12 = temp;
thisFace.getAdjacentNodes(adj2, adj21, temp);
if (temp.getID() != m_node.getID())
if (temp.id() != m_node.id())
adj21 = temp;

n12 = Real3(adj12.X(), adj12.Y(), adj12.Z());
Expand Down
3 changes: 2 additions & 1 deletion smooth3D/src/opt2D/ObjectiveCondition2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#define OBJECTIVECONDITION2D_H_

#include "IObjective3D.h"
#include "GMDS/IG/IG.h"
#include "gmds/ig/Node.h"
#include "gmds/ig/Face.h"

namespace Smooth3D {

Expand Down
3 changes: 2 additions & 1 deletion smooth3D/src/opt2D/ObjectiveOrthogonal2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#define OPT2D_OBJECTIVEORTHOGONAL2D_H_

#include "IObjective3D.h"
#include <GMDS/IG/IG.h>
#include <gmds/ig/Node.h>
#include <gmds/ig/Face.h>

namespace Smooth3D {

Expand Down
24 changes: 11 additions & 13 deletions smooth3D/src/opt2D/s3_conditionnumber2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <cstdlib> // pour rand

#include "smooth3D/smooth.h"
#include <GMDS/IG/IGMesh.h>
#include <GMDS/IG/IGMeshDoctor.h>
#include <gmds/ig/Mesh.h>
#include <gmds/ig/MeshDoctor.h>

#include "math/Real3.h"

Expand All @@ -32,7 +32,7 @@ extern "C" int S3_ConditionNumber2D(
int_type n_iter)
{
const int tGMDSMask = gmds::DIM3 | gmds::N | gmds::F | gmds::F2N | gmds::N2F;
gmds::IGMesh internal_mesh(tGMDSMask);
gmds::Mesh internal_mesh(tGMDSMask);

gmds::Node * temp_array_nodes = new gmds::Node [nb_nodes];

Expand All @@ -47,7 +47,7 @@ extern "C" int S3_ConditionNumber2D(
internal_mesh.newFace(nodes_cell);
}

gmds::IGMeshDoctor mesh_doc(&internal_mesh);
gmds::MeshDoctor mesh_doc(&internal_mesh);
mesh_doc.updateUpwardConnectivity();

delete[] temp_array_nodes;
Expand All @@ -61,14 +61,13 @@ extern "C" int S3_ConditionNumber2D(
for (int iter = 0; iter < n_iter; iter++) {

// LOOP 2 : FOR ALL NODES
for (gmds::IGMesh::node_iterator it = internal_mesh.nodes_begin();
!it.isDone(); it.next()) {
gmds::Node current_node = it.value();
if (relax[current_node.getID()] != 0.0) {
for (auto i : internal_mesh.nodes()){
auto current_node = internal_mesh.get<gmds::Node>(i);
if (relax[current_node.id()] != 0.0) {

// We are only interested on Relaxed nodes
condition.set_node(current_node);
int nb_faces = current_node.getNbFaces();
int nb_faces = current_node.nbFaces();

// First face connected to the node is chosen ramdomly
int face_int = std::rand() % nb_faces;
Expand Down Expand Up @@ -147,10 +146,9 @@ extern "C" int S3_ConditionNumber2D(
}


for (gmds::IGMesh::node_iterator it = internal_mesh.nodes_begin();
!it.isDone(); it.next()) {
gmds::Node current_node = it.value();
int vtx = current_node.getID();
for (auto i : internal_mesh.nodes()){
auto current_node = internal_mesh.get<gmds::Node>(i);
int vtx = current_node.id();
double rel = relax[vtx];

if (rel != 0.0)
Expand Down
33 changes: 18 additions & 15 deletions smooth3D/src/opt2D/s3_orthogonal2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <cstdlib> // pour rand

#include "smooth3D/smooth.h"
#include <GMDS/IG/IGMesh.h>
#include <GMDS/IG/IGMeshDoctor.h>
#include <gmds/ig/Mesh.h>
#include <gmds/ig/MeshDoctor.h>

#include "math/Real3.h"

Expand All @@ -32,7 +32,7 @@ extern "C" int S3_Orthogonal2D(
int_type n_iter)
{
const int tGMDSMask = gmds::DIM3 | gmds::N | gmds::F | gmds::F2N | gmds::N2F;
gmds::IGMesh internal_mesh(tGMDSMask);
gmds::Mesh internal_mesh(tGMDSMask);

gmds::Node * temp_array_nodes = new gmds::Node [nb_nodes];

Expand All @@ -47,7 +47,7 @@ extern "C" int S3_Orthogonal2D(
internal_mesh.newFace(nodes_cell);
}

gmds::IGMeshDoctor mesh_doc(&internal_mesh);
gmds::MeshDoctor mesh_doc(&internal_mesh);
mesh_doc.updateUpwardConnectivity();

delete[] temp_array_nodes;
Expand All @@ -61,14 +61,16 @@ extern "C" int S3_Orthogonal2D(
for (int iter = 0; iter < n_iter; iter++) {

// LOOP 2 : FOR ALL NODES
for (gmds::IGMesh::node_iterator it = internal_mesh.nodes_begin();
!it.isDone(); it.next()) {
gmds::Node current_node = it.value();
if (relax[current_node.getID()] != 0.0) {
//for (gmds::Mesh::node_iterator it = internal_mesh.nodes_begin();
//!it.isDone(); it.next()) {
for (auto i : internal_mesh.nodes()){
//gmds::Node current_node = it.value();
auto current_node = internal_mesh.get<gmds::Node>(i);
if (relax[current_node.id()] != 0.0) {

// We are only interested on Relaxed nodes
orthogonal.setNode(current_node);
int nb_faces = current_node.getNbFaces();
int nb_faces = current_node.nbFaces();

// First face connected to the node is chosen ramdomly
int face_int = std::rand() % nb_faces;
Expand Down Expand Up @@ -145,12 +147,13 @@ extern "C" int S3_Orthogonal2D(
}
}
}


for (gmds::IGMesh::node_iterator it = internal_mesh.nodes_begin();
!it.isDone(); it.next()) {
gmds::Node current_node = it.value();
int vtx = current_node.getID();

// for (gmds::Mesh::node_iterator it = internal_mesh.nodes_begin();
// !it.isDone(); it.next()) {
// gmds::Node current_node = it.value();
for (auto i : internal_mesh.nodes()){
auto current_node = internal_mesh.get<gmds::Node>(i);
int vtx = current_node.id();
double rel = relax[vtx];

if (rel != 0.0)
Expand Down