Skip to content

Commit f075a51

Browse files
committed
[geogram] Update to 1.6.2
1 parent 9bfed1f commit f075a51

12 files changed

Lines changed: 415 additions & 38 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ include(cmake/geogram.cmake)
3939

4040
set(VORPALINE_VERSION_MAJOR 1)
4141
set(VORPALINE_VERSION_MINOR 6)
42-
set(VORPALINE_VERSION_PATCH 1)
42+
set(VORPALINE_VERSION_PATCH 2)
4343
set(VORPALINE_VERSION ${VORPALINE_VERSION_MAJOR}.${VORPALINE_VERSION_MINOR}.${VORPALINE_VERSION_PATCH})
4444

4545
set(VORPALINE_INCLUDE_SUBPATH geogram${VORPALINE_VERSION_MAJOR})

cmake/geogram.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
if(NOT DEFINED GEOGRAM_SOURCE_DIR)
33
set(GEOGRAM_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
44
endif()
5-
5+
message(STATUS "GEOGRAM_SOURCE_DIR: ${GEOGRAM_SOURCE_DIR}")
66
if(EXISTS ${GEOGRAM_SOURCE_DIR}/CMakeOptions.txt)
77
message(STATUS "Using local options file: ${GEOGRAM_SOURCE_DIR}/CMakeOptions.txt")
88
include(${GEOGRAM_SOURCE_DIR}/CMakeOptions.txt)

src/examples/geogram/opennl_LSCM/main.cpp

100755100644
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -817,12 +817,12 @@ class LSCM {
817817
for(i=0; i<mesh_->vertex.size(); i++) {
818818
const Vertex& v = mesh_->vertex[i];
819819
xmin = std::min(v.point.x, xmin);
820-
ymin = std::min(v.point.y, xmin);
821-
zmin = std::min(v.point.z, xmin);
820+
ymin = std::min(v.point.y, ymin);
821+
zmin = std::min(v.point.z, zmin);
822822

823-
xmax = std::max(v.point.x, xmin);
824-
ymax = std::max(v.point.y, xmin);
825-
zmax = std::max(v.point.z, xmin);
823+
xmax = std::max(v.point.x, xmax);
824+
ymax = std::max(v.point.y, ymax);
825+
zmax = std::max(v.point.z, zmax);
826826
}
827827

828828
double dx = xmax - xmin;
@@ -832,23 +832,23 @@ class LSCM {
832832
vec3 V1,V2;
833833

834834
// Find shortest bbox axis
835-
if(dx < dy && dx < dz) {
835+
if(dx <= dy && dx <= dz) {
836836
if(dy > dz) {
837837
V1 = vec3(0,1,0);
838838
V2 = vec3(0,0,1);
839839
} else {
840840
V2 = vec3(0,1,0);
841841
V1 = vec3(0,0,1);
842842
}
843-
} else if(dy < dx && dy < dz) {
843+
} else if(dy <= dx && dy <= dz) {
844844
if(dx > dz) {
845845
V1 = vec3(1,0,0);
846846
V2 = vec3(0,0,1);
847847
} else {
848848
V2 = vec3(1,0,0);
849849
V1 = vec3(0,0,1);
850850
}
851-
} else if(dz < dx && dz < dy) {
851+
} else if(dz <= dx && dz <= dy) {
852852
if(dx > dy) {
853853
V1 = vec3(1,0,0);
854854
V2 = vec3(0,1,0);

src/lib/geogram/basic/attributes.cpp

100755100644
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace GEO {
5656
}
5757

5858
void AttributeStoreObserver::unregister_me(AttributeStore* store) {
59-
store->unregister_observer(this);
59+
store->unregister_observer(this);
6060
}
6161

6262
/******************************************************************/
@@ -107,9 +107,15 @@ namespace GEO {
107107
}
108108

109109
AttributeStore::~AttributeStore() {
110-
// It is illegal to keep an Attribute<> active
111-
// when the object it is bound to is destroyed.
112-
geo_assert(!has_observers());
110+
// Disconnect all the attributes, for the special case where
111+
// the AttributeStore is destroyed before the Attributes, can
112+
// occur for instance when using Lua scripting with Attribute wrapper
113+
// objects.
114+
for(std::set<AttributeStoreObserver*>::iterator
115+
it = observers_.begin(); it!=observers_.end(); ++it
116+
) {
117+
(*it)->disconnect();
118+
}
113119
}
114120

115121
void AttributeStore::register_observer(AttributeStoreObserver* observer) {

src/lib/geogram/basic/attributes.h

100755100644
Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ namespace GEO {
7676
/**
7777
* \brief Creates a new uninitialied AttributeStore.
7878
*/
79-
AttributeStoreObserver() : base_addr_(nil), size_(0), dimension_(0) {
79+
AttributeStoreObserver() :
80+
base_addr_(nil), size_(0), dimension_(0),
81+
disconnected_(false) {
8082
}
8183

8284
/**
@@ -120,21 +122,42 @@ namespace GEO {
120122
return size_ * dimension_;
121123
}
122124

125+
/**
126+
* \brief Registers this observer to an AttributeStore.
127+
* \param[in] store a pointer to the AttributeStore.
128+
*/
123129
void register_me(AttributeStore* store);
124-
130+
131+
/**
132+
* \brief Unregisters this observer from an AttributeStore.
133+
* \param[in] store a pointer to the AttributeStore.
134+
*/
125135
void unregister_me(AttributeStore* store);
126136

127-
137+
/**
138+
* \brief Disconnects this AttributeStoreObserver from its
139+
* AttributeStore.
140+
* \details This function is called whenever the AttributeManager is
141+
* destroyed before the Attributes (can occur when using Lua scripting
142+
* with Attribute wrapper objects).
143+
*/
144+
void disconnect() {
145+
base_addr_ = nil;
146+
size_ = 0;
147+
dimension_ = 0;
148+
disconnected_ = true;
149+
}
150+
128151
protected:
129152
Memory::pointer base_addr_;
130153
index_t size_;
131154
index_t dimension_;
155+
bool disconnected_;
132156
};
133157

134158

135159
/*********************************************************************/
136160

137-
class AttributeStore;
138161

139162
/**
140163
* \brief Internal class for creating an AttributeStore
@@ -902,7 +925,7 @@ namespace GEO {
902925
* \retval false otherwise
903926
*/
904927
bool is_bound() const {
905-
return (store_ != nil);
928+
return (store_ != nil && !disconnected_);
906929
}
907930

908931
/**
@@ -911,7 +934,12 @@ namespace GEO {
911934
*/
912935
void unbind() {
913936
geo_assert(is_bound());
914-
unregister_me(store_);
937+
// If the AttributeManager was destroyed before, do not
938+
// do anything. This can occur in Lua scripting when using
939+
// Attribute wrapper objects.
940+
if(!disconnected_) {
941+
unregister_me(store_);
942+
}
915943
manager_ = nil;
916944
store_ = nil;
917945
}

src/lib/geogram/mesh/mesh_io.cpp

Lines changed: 141 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4139,7 +4139,146 @@ namespace GEO {
41394139
}
41404140

41414141
};
4142-
4142+
4143+
/************************************************************************/
4144+
4145+
/**
4146+
* \brief Mesh IO Handler for OpenVolumeMesh file format.
4147+
* \details Saves a polyhedral mesh stored in a surfacic mesh that
4148+
* has all cell boundaries and a vertex_id vertex attribute and cell_id
4149+
* facet attribute. Note: the implementation is pretty inefficient (uses
4150+
* tables).
4151+
*/
4152+
class FluentIOHandler : public MeshIOHandler {
4153+
private:
4154+
enum {
4155+
XF_COMMENT = 0,
4156+
XF_HEADER = 1,
4157+
XF_DIMENSION = 2,
4158+
XF_NODE = 10,
4159+
XF_CELL = 12
4160+
};
4161+
public:
4162+
/**
4163+
* \copydoc MeshIOHandler::load()
4164+
*/
4165+
virtual bool load(
4166+
const std::string& filename, Mesh& M,
4167+
const MeshIOFlags& ioflags
4168+
) {
4169+
geo_argused(filename);
4170+
geo_argused(M);
4171+
geo_argused(ioflags);
4172+
Logger::err("I/O")
4173+
<< "load() not implemented yet for Fluent file format"
4174+
<< std::endl;
4175+
return false;
4176+
}
4177+
4178+
/**
4179+
* \copydoc MeshIOHandler::save()
4180+
*/
4181+
virtual bool save(
4182+
const Mesh& M, const std::string& filename,
4183+
const MeshIOFlags& ioflags = MeshIOFlags()
4184+
) {
4185+
geo_argused(ioflags);
4186+
std::ofstream out(filename.c_str());
4187+
if(!out) {
4188+
Logger::err("I/O")
4189+
<< "save(): could not create file: " << filename
4190+
<< std::endl;
4191+
return false;
4192+
}
4193+
4194+
/*************************************************************/
4195+
4196+
out << "("
4197+
<< XF_HEADER
4198+
<< " \" Geogram/Vorpaline"
4199+
<< " ver:" << Environment::instance()->get_value("version")
4200+
<< " rel:" << Environment::instance()->get_value("release_date")
4201+
<< " SVN:" << Environment::instance()->get_value("SVN revision")
4202+
<< "\")"
4203+
<< std::endl;
4204+
4205+
std::vector<std::string> args;
4206+
CmdLine::get_args(args);
4207+
for(index_t i=0; i<index_t(args.size()); ++i) {
4208+
out << "("
4209+
<< XF_COMMENT
4210+
<< "\" CmdLine:"
4211+
<< args[i]
4212+
<< "\")"
4213+
<< std::endl;
4214+
}
4215+
4216+
index_t dim = M.vertices.dimension();
4217+
if(dim > 3) {
4218+
dim = 3;
4219+
}
4220+
4221+
out << "("
4222+
<< XF_DIMENSION
4223+
<< " "
4224+
<< dim
4225+
<< ")"
4226+
<< std::endl;
4227+
4228+
/*************************************************************/
4229+
4230+
// Declare the total number of nodes
4231+
out << "("
4232+
<< XF_NODE
4233+
<< " ("
4234+
<< 0 << " " // zone-id
4235+
<< 1 << " " // first index
4236+
4237+
<< std::hex
4238+
<< M.vertices.nb() // last index in hexa (?!?)
4239+
<< std::dec << " "
4240+
4241+
<< 0 << " " // type
4242+
<< "))"
4243+
<< std::endl;
4244+
4245+
// Now declare a zone with nodes.
4246+
out << "("
4247+
<< XF_NODE
4248+
<< " ("
4249+
<< 1 << " " // zone-id
4250+
<< 1 << " " // first index
4251+
4252+
<< std::hex
4253+
<< M.vertices.nb() // last index in hexa (?!?)
4254+
<< std::dec << " "
4255+
4256+
<< 1 << " " // type
4257+
<< dim << " " // ND
4258+
<< ")("
4259+
<< std::endl;
4260+
4261+
for(index_t v=0; v<M.vertices.nb(); ++v) {
4262+
double point[3];
4263+
get_mesh_point(M, v, point, dim);
4264+
for(index_t i=0; i<dim; ++i) {
4265+
out << point[i] << " ";
4266+
}
4267+
out << std::endl;
4268+
}
4269+
4270+
out << "))" << std::endl;
4271+
4272+
/*************************************************************/
4273+
4274+
4275+
4276+
/*************************************************************/
4277+
4278+
return true;
4279+
}
4280+
private:
4281+
};
41434282

41444283
}
41454284

@@ -4329,6 +4468,7 @@ namespace GEO {
43294468
geo_register_MeshIOHandler_creator(PDBIOHandler, "pdb");
43304469
geo_register_MeshIOHandler_creator(PDBIOHandler, "pdb1");
43314470
geo_register_MeshIOHandler_creator(OVMIOHandler, "ovm");
4471+
geo_register_MeshIOHandler_creator(FluentIOHandler, "msh");
43324472
}
43334473

43344474

src/lib/geogram/parameterization/mesh_LSCM.cpp

100755100644
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -506,12 +506,12 @@ namespace {
506506
for(i=0; i<mesh_.vertices.nb(); i++) {
507507
const vec3& p = Geom::mesh_vertex(mesh_,i);
508508
xmin = std::min(p.x, xmin);
509-
ymin = std::min(p.y, xmin);
510-
zmin = std::min(p.z, xmin);
509+
ymin = std::min(p.y, ymin);
510+
zmin = std::min(p.z, zmin);
511511

512-
xmax = std::max(p.x, xmin);
513-
ymax = std::max(p.y, xmin);
514-
zmax = std::max(p.z, xmin);
512+
xmax = std::max(p.x, xmax);
513+
ymax = std::max(p.y, ymax);
514+
zmax = std::max(p.z, zmax);
515515
}
516516

517517
double dx = xmax - xmin;
@@ -521,23 +521,23 @@ namespace {
521521
vec3 V1,V2;
522522

523523
// Find shortest bbox axis
524-
if(dx < dy && dx < dz) {
524+
if(dx <= dy && dx <= dz) {
525525
if(dy > dz) {
526526
V1 = vec3(0,1,0);
527527
V2 = vec3(0,0,1);
528528
} else {
529529
V2 = vec3(0,1,0);
530530
V1 = vec3(0,0,1);
531531
}
532-
} else if(dy < dx && dy < dz) {
532+
} else if(dy <= dx && dy <= dz) {
533533
if(dx > dz) {
534534
V1 = vec3(1,0,0);
535535
V2 = vec3(0,0,1);
536536
} else {
537537
V2 = vec3(1,0,0);
538538
V1 = vec3(0,0,1);
539539
}
540-
} else if(dz < dx && dz < dy) {
540+
} else if(dz <= dx && dz <= dy) {
541541
if(dx > dy) {
542542
V1 = vec3(1,0,0);
543543
V2 = vec3(0,1,0);

src/lib/geogram/parameterization/mesh_atlas_maker.cpp

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ namespace {
177177

178178
// Ignore problems for small charts.
179179
// TODO: check if we can remove that
180-
// (unfortunately, does not seems so...)
180+
// (unfortunately, does not seems so...
181+
// if(false)
181182
if(!OK && chart.facets.size() <= 10) {
182183
if(verbose_) {
183184
Logger::out("ParamValidator")

src/lib/geogram_gfx/GLUP/shaders/fullscreen/embedded_shaders.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)