Commit 4d46728d authored by untereiner's avatar untereiner
Browse files

Merge cgogn:~thery/CGoGN

parents c45c3130 a7481434
......@@ -965,7 +965,7 @@ void Clipping::cb_keyPress(int code)
}
}
void Clipping::cb_mousePress(int button, int x, int y)
void Clipping::cb_mousePress(int /*button*/, int x, int y)
{
// Check if no animation is active
if (m_lastAnimatedClippingPreset != NULL)
......
......@@ -145,7 +145,7 @@ void MyQT::cb_redraw()
}
void MyQT::cb_mousePress(int button, int x, int y)
void MyQT::cb_mousePress(int /*button*/, int x, int y)
{
if (!Shift())
return;
......@@ -249,7 +249,7 @@ void MyQT::cb_mouseMove(int buttons, int x, int y)
}
void MyQT::cb_wheelEvent(int delta, int x, int y)
void MyQT::cb_wheelEvent(int delta, int /*x*/, int /*y*/)
{
if (!Shift())
return;
......
......@@ -157,17 +157,17 @@ void TexView::cb_keyPress(int code)
updateGL();
}
void TexView::init(char *fnm, char* fnt)
void TexView::init(const std::string& fnm, const std::string& fnt)
{
if (fnm == NULL)
if (fnm.empty() )
{
computeTore();
m_fileNameTex = std::string(fnt);
m_fileNameTex = fnt;
}
else
{
m_fileNameMesh = std::string(fnm);
m_fileNameTex = std::string(fnt);
m_fileNameMesh = fnm;
m_fileNameTex = fnt;
std::vector<std::string> attrNames;
m_obj.import(m_fileNameMesh,attrNames);
......@@ -260,11 +260,11 @@ int main(int argc, char**argv)
}
else if (argc == 2)
{
tv.init(NULL, argv[1]);
tv.init("", argv[1]);
}
else
{
tv.init(NULL,"x");
tv.init("","x");
}
......
......@@ -89,7 +89,7 @@ public:
~TexView();
void init(char* fnm, char* fnt);
void init(const std::string& fnm, const std::string& fnt);
// callbacks of simpleQT to overdefine:
void cb_redraw();
......
......@@ -33,24 +33,26 @@
#include "Utils/chrono.h"
#include "Algo/Export/exportVol.h"
PFP::MAP myMap;
VertexAttribute<PFP::VEC3> position ;
VolumeAttribute<PFP::VEC3> color ;
void MyQT::volumes_onoff(bool x)
void MyQT::volumes_onoff(bool /*x*/)
{
render_volumes = !render_volumes;
updateGL();
}
void MyQT::edges_onoff(bool x)
void MyQT::edges_onoff(bool /*x*/)
{
render_edges = !render_edges;
updateGL();
}
void MyQT::topo_onoff(bool x)
void MyQT::topo_onoff(bool /*x*/)
{
render_topo = !render_topo;
if (render_topo)
......@@ -88,7 +90,7 @@ void MyQT::clipping_onoff(bool x)
updateGL();
}
void MyQT::hide_onoff(bool x)
void MyQT::hide_onoff(bool /*x*/)
{
hide_clipping = !hide_clipping;
updateGL();
......@@ -270,7 +272,7 @@ void MyQT::cb_redraw()
}
void MyQT::cb_mousePress(int button, int x, int y)
void MyQT::cb_mousePress(int /*button*/, int x, int y)
{
if (!Shift())
return;
......@@ -299,7 +301,7 @@ void MyQT::cb_mousePress(int button, int x, int y)
}
}
void MyQT::cb_mouseRelease(int button, int x, int y)
void MyQT::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/)
{
if (hide_clipping || !clip_volume)
......@@ -418,6 +420,12 @@ int main(int argc, char **argv)
color[i][0] /= maxV;
color[i][2] = 1.0f - color[i][0];
}
// Algo::Volume::Export::exportNAS<PFP>(myMap,position,"/tmp/test2.nas");
// Algo::Volume::Export::exportMSH<PFP>(myMap,position,"/tmp/test2.msh");
// Algo::Volume::Export::exportTet<PFP>(myMap,position,"/tmp/test2.tet");
// Algo::Volume::Export::exportNodeEle<PFP>(myMap,position,"/tmp/test2");
// Algo::Volume::Export::exportVTU<PFP>(myMap,position,"/tmp/test4.vtu");
}
else
{
......@@ -437,6 +445,9 @@ int main(int argc, char **argv)
TraversorW<PFP::MAP> tra(myMap);
for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
color[d] = position[d] + PFP::VEC3(0.5,0.5,0.5);
// Algo::Volume::Export::exportMSH<PFP>(myMap,position,"/tmp/test2.msh");
// Algo::Volume::Export::exportNAS<PFP>(myMap,position,"/tmp/test1.nas");
// Algo::Volume::Export::exportVTU<PFP>(myMap,position,"/tmp/test3.vtu");
}
// un peu d'interface
QApplication app(argc, argv);
......
......@@ -140,7 +140,7 @@ void MyQT::cb_redraw()
m_drawer.callList();
}
void MyQT::cb_mousePress(int button, int x, int y)
void MyQT::cb_mousePress(int /*button*/, int x, int y)
{
if (Shift())
{
......
......@@ -38,21 +38,21 @@ MAP myMap;
VertexAttribute<VEC3> position ;
Dart dglobal;
void MyQT::balls_onoff(bool x)
void MyQT::balls_onoff(bool /*x*/)
{
render_balls = !render_balls;
updateGL();
CGoGNerr << " balls_onoff "<< CGoGNendl;
}
void MyQT::vectors_onoff(bool x)
void MyQT::vectors_onoff(bool /*x*/)
{
render_vectors = !render_vectors;
updateGL();
CGoGNerr << " vectors_onoff "<< CGoGNflush;
}
void MyQT::text_onoff(bool x)
void MyQT::text_onoff(bool /*x*/)
{
render_text = !render_text;
updateGL();
......@@ -60,7 +60,7 @@ void MyQT::text_onoff(bool x)
}
void MyQT::topo_onoff(bool x)
void MyQT::topo_onoff(bool /*x*/)
{
render_topo = !render_topo;
updateGL();
......@@ -211,7 +211,7 @@ void MyQT::cb_redraw()
}
}
void MyQT::cb_mousePress(int button, int x, int y)
void MyQT::cb_mousePress(int /*button*/, int x, int y)
{
if (Shift())
{
......
......@@ -146,7 +146,7 @@ public:
FunctorAttribThreaded(),m_positions(pos),m_positions2(pos2)
{}
void run(unsigned int i, unsigned int threadID)
void run(unsigned int i, unsigned int /*threadID*/)
{
m_positions2[i] = 1.1f * m_positions[i];
}
......@@ -181,7 +181,7 @@ public:
m_positions(pos),m_positions2(pos2)
{}
void run(Dart d, unsigned int threadID)
void run(Dart d, unsigned int /*threadID*/)
{
typename XXX::VEC3 Q(0,0,0);
int nb=0;
......@@ -232,7 +232,7 @@ public:
unsigned int getNb() { return m_nb;}
void run(Dart d, unsigned int threadID)
void run(Dart d, unsigned int /*threadID*/)
{
Dart dd = this->m_map.phi2(d);
typename XXX::VEC3 V = m_positions[dd] - m_positions[d];
......
......@@ -88,7 +88,7 @@ void MyQT::clipping_onoff(bool x)
updateGL();
}
void MyQT::hide_onoff(bool x)
void MyQT::hide_onoff(bool /*x*/)
{
hide_clipping = !hide_clipping;
updateMap();
......@@ -253,7 +253,7 @@ void MyQT::operation(int x)
dock.listOper->setCurrentRow(-1);
}
void MyQT::createMap(int n)
void MyQT::createMap(int /*n*/)
{
myMap.clear(true);
position = myMap.getAttribute<VEC3, VERTEX>("position");
......@@ -440,7 +440,7 @@ void MyQT::cb_mousePress(int button, int x, int y)
}
}
void MyQT::cb_mouseRelease(int button, int x, int y)
void MyQT::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/)
{
if (hide_clipping || !clip_volume)
......
......@@ -42,7 +42,7 @@ VertexAttribute<VEC3> position ;
DartAttribute<VEC3> middleDarts;
void MyQT::text_onoff(bool x)
void MyQT::text_onoff(bool /*x*/)
{
render_text = !render_text;
updateGL();
......@@ -162,7 +162,7 @@ void MyQT::cb_redraw()
}
void MyQT::cb_mousePress(int button, int x, int y)
void MyQT::cb_mousePress(int /*button*/, int x, int y)
{
if (Shift())
{
......
......@@ -138,8 +138,9 @@ IF(WIN32)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
# set(CMAKE_CONFIGURATION_TYPES "Release Debug" CACHE STRING "Only Release or Debug" FORCE)
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fPIC")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -fPIC")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Woverride-init -fPIC")
add_subdirectory(Release)
add_subdirectory(Debug)
add_subdirectory(${CGoGN_ROOT_DIR}/Apps Apps)
......
......@@ -105,7 +105,7 @@ IF(WIN32)
set(CMAKE_CONFIGURATION_TYPES Release Debug)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra ")
ENDIF(WIN32)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
......
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __EXPORT_VOL_H__
#define __EXPORT_VOL_H__
#include "Topology/generic/attributeHandler.h"
#include <stdint.h>
namespace CGoGN
{
namespace Algo
{
namespace Volume
{
namespace Export
{
/**
* export the map into a .nas (nastran file)
* @param the_map map to be exported
* @param position the position container
* @param filename filename of ply file
* @param binary write in binary mode
* @return true
*/
template <typename PFP>
bool exportNAS(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename) ;
/**
* export the map into a vtu file (vtk unstructured grid)
* @param the_map map to be exported
* @param position the position container
* @param filename filename of ply file
* @param binary write in binary mode
* @return true
*/
template <typename PFP>
bool exportVTU(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename) ;
/**
* export the map into a .msh (gmesh file)
* @param the_map map to be exported
* @param position the position container
* @param filename filename of ply file
* @param binary write in binary mode
* @return true
*/
template <typename PFP>
bool exportMSH(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename) ;
/**
* export the map into a .tet file
* @param the_map map to be exported
* @param position the position container
* @param filename filename of ply file
* @param binary write in binary mode
* @return true
*/
template <typename PFP>
bool exportTet(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename) ;
/**
* export the map into a .node/.ele file pair
* @param the_map map to be exported
* @param position the position container
* @param filename filename of ply file
* @param binary write in binary mode
* @return true
*/
template <typename PFP>
bool exportNodeEle(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename) ;
} // namespace Export
}
} // namespace Algo
} // namespace CGoGN
#include "Algo/Export/exportVol.hpp"
#endif
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "Topology/generic/attributeHandler.h"
#include "Topology/generic/autoAttributeHandler.h"
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2.h"
#include "Topology/generic/cellmarker.h"
namespace CGoGN
{
namespace Algo
{
namespace Volume
{
namespace Export
{
inline std::string truncFloatTO8(float f)
{
std::stringstream ss;
ss << f;
std::string res = ss.str();
return res.substr(0,8);
}
template <typename PFP>
bool exportNAS(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename)
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
// open file
std::ofstream fout ;
fout.open(filename, std::ios::out) ;
if (!fout.good())
{
CGoGNerr << "Unable to open file " << filename << CGoGNendl ;
return false ;
}
VertexAutoAttribute<unsigned int> indices(map,"indices_vert");
fout << "$$ ---------------------------------------------------------------------------- $"<< std::endl;
fout << "$$ NASTRAN MEsh File Generated by CGoGN (ICube/IGG) $"<< std::endl;
fout << "$$ ---------------------------------------------------------------------------- $"<< std::endl;
fout << "CEND" << std::endl;;
fout << "BEGIN BULK" << std::endl;
fout << "$$ ---------------------------------------------------------------------------- $"<< std::endl;
fout << "$$ Vertices position $"<< std::endl;
fout << "$$ ---------------------------------------------------------------------------- $"<< std::endl;
unsigned int count=1;
for (unsigned int i = position.begin(); i != position.end(); position.next(i))
{
const VEC3& P = position[i];
fout << "GRID ";
fout << std::right;
fout.width(8);
fout << count;
fout << " ";
fout << std::left;
fout << std::setw(8)<<truncFloatTO8(P[0]) << std::setw(8)<<truncFloatTO8(P[1]) << std::setw(8)<<truncFloatTO8(P[2]) << std::endl;
indices[i] = count++;
}
std::vector<unsigned int> hexa;
std::vector<unsigned int> tetra;
hexa.reserve(2048);
tetra.reserve(2048);
TraversorW<MAP> trav(map) ;
for(Dart d = trav.begin(); d != trav.end(); d = trav.next())
{
unsigned int degree = 0 ;
Traversor3WV<typename PFP::MAP> twv(map, d) ;
for(Dart it = twv.begin(); it != twv.end(); it = twv.next())
{
degree++;
}
if (degree == 8)
{
//CAS HEXAEDRIQUE (ordre 2 quad superposes, le premier en CCW)
Dart e = d;
Dart f = map.template phi<21121>(d);
hexa.push_back(indices[f]);
e = map.phi_1(f);
hexa.push_back(indices[f]);
e = map.phi_1(f);
hexa.push_back(indices[f]);
e = map.phi_1(f);
hexa.push_back(indices[f]);
hexa.push_back(indices[e]);
e = map.phi1(e);
hexa.push_back(indices[e]);
e = map.phi1(e);
hexa.push_back(indices[e]);
e = map.phi1(e);
hexa.push_back(indices[e]);
}
if (degree == 4)
{
//CAS TETRAEDRIQUE (ordre 2 quad superposes, le premier en CCW)
Dart e = d;
tetra.push_back(indices[e]);
e = map.phi1(e);
tetra.push_back(indices[e]);
e = map.phi1(e);
tetra.push_back(indices[e]);
e = map.template phi<211>(e);
tetra.push_back(indices[e]);
}
}
unsigned int countCell=1;
unsigned int nbhexa = hexa.size()/8;
unsigned int nbtetra = tetra.size()/4;
fout << std::right;
if (nbhexa!=0)
{
fout << "$$ ---------------------------------------------------------------------------- $"<< std::endl;
fout << "$$ Hexa indices $"<< std::endl;
fout << "$$ ---------------------------------------------------------------------------- $"<< std::endl;
for (unsigned int i=0; i<nbhexa; ++i)
{
fout << "CHEXA ";
fout << std::setw(8) << countCell++ << std::setw(8)<< 0;
fout << std::setw(8) << hexa[8*i] << std::setw(8) << hexa[8*i+1] << std::setw(8) << hexa[8*i+2];
fout << std::setw(8) << hexa[8*i+3] << std::setw(8) << hexa[8*i+4] << std::setw(8) << hexa[8*i+5] << "+"<< std::endl;
fout << "+ " << std::setw(8) << hexa[8*i+6] << std::setw(8) << hexa[8*i+7] << std::endl;
}
}
if (nbtetra != 0)
{
fout << "$$ ---------------------------------------------------------------------------- $"<< std::endl;
fout << "$$ Tetra indices $"<< std::endl;
fout << "$$ ---------------------------------------------------------------------------- $"<< std::endl;
for (unsigned int i=0; i<nbtetra; ++i)
{
fout << "CTETRA ";
fout << std::setw(8) << countCell++ << std::setw(8)<< 0;
fout << std::setw(8) << tetra[4*i] << std::setw(8) << tetra[4*i+1] << std::setw(8) << tetra[4*i+2] << std::setw(8) << tetra[4*i+3] << std::endl;
}
}
fout << "ENDDATA" << std::endl;
fout.close();
return true;
}
template <typename PFP>
bool exportVTU(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, const char* filename)
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
// open file
std::ofstream fout ;
fout.open(filename, std::ios::out) ;