Skip to content

Commit

Permalink
csmeuler_laringmv optimization. New compilation macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel committed Nov 5, 2018
1 parent da9a039 commit 6ff5f80
Show file tree
Hide file tree
Showing 73 changed files with 6,807 additions and 164 deletions.
18 changes: 14 additions & 4 deletions rGWB.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@
559452861F79A0E5002AF198 /* csmquadrics.c in Sources */ = {isa = PBXBuildFile; fileRef = 559452841F79A0E5002AF198 /* csmquadrics.c */; };
559452871F79A0E5002AF198 /* csmquadrics.h in Headers */ = {isa = PBXBuildFile; fileRef = 559452851F79A0E5002AF198 /* csmquadrics.h */; settings = {ATTRIBUTES = (Public, ); }; };
5598D6131F24E7F600EA1876 /* csmviewer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5598D6111F24E7F600EA1876 /* csmviewer.mm */; };
5598D6141F24E7F600EA1876 /* csmviewer.inl in Resources */ = {isa = PBXBuildFile; fileRef = 5598D6121F24E7F600EA1876 /* csmviewer.inl */; };
5598D65C1F24EE4000EA1876 /* basicGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5598D6341F24E8AF00EA1876 /* basicGraphics.framework */; };
5598D6661F24EE4000EA1876 /* basicMenu.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5598D6611F24EE4000EA1876 /* basicMenu.framework */; };
5598D6671F24EE4000EA1876 /* basicReceptor.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5598D6621F24EE4000EA1876 /* basicReceptor.framework */; };
Expand Down Expand Up @@ -175,6 +174,10 @@
55FAB61C20D83CA6008E1DFF /* csmsave.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FAB61A20D83CA6008E1DFF /* csmsave.h */; settings = {ATTRIBUTES = (Public, ); }; };
55FAB62220D8566F008E1DFF /* csmwriteablesolid.c in Sources */ = {isa = PBXBuildFile; fileRef = 55FAB62020D8566F008E1DFF /* csmwriteablesolid.c */; };
55FAB62320D8566F008E1DFF /* csmwriteablesolid.inl in Headers */ = {isa = PBXBuildFile; fileRef = 55FAB62120D8566F008E1DFF /* csmwriteablesolid.inl */; };
55FEB004218FA47100C114A6 /* csmtest2.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FEB002218FA47100C114A6 /* csmtest2.h */; settings = {ATTRIBUTES = (Public, ); }; };
55FEB005218FA47100C114A6 /* csmtest2.c in Sources */ = {isa = PBXBuildFile; fileRef = 55FEB003218FA47100C114A6 /* csmtest2.c */; };
55FEB009218FA99C00C114A6 /* csmviewer.inl in Resources */ = {isa = PBXBuildFile; fileRef = 5598D6121F24E7F600EA1876 /* csmviewer.inl */; };
55FEB00A218FA9B700C114A6 /* csmviewer.inl in Headers */ = {isa = PBXBuildFile; fileRef = 5598D6121F24E7F600EA1876 /* csmviewer.inl */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -417,6 +420,8 @@
55FAB61A20D83CA6008E1DFF /* csmsave.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 2; path = csmsave.h; sourceTree = "<group>"; };
55FAB62020D8566F008E1DFF /* csmwriteablesolid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; lineEnding = 2; path = csmwriteablesolid.c; sourceTree = "<group>"; };
55FAB62120D8566F008E1DFF /* csmwriteablesolid.inl */ = {isa = PBXFileReference; lastKnownFileType = text; lineEnding = 2; path = csmwriteablesolid.inl; sourceTree = "<group>"; };
55FEB002218FA47100C114A6 /* csmtest2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = csmtest2.h; sourceTree = "<group>"; };
55FEB003218FA47100C114A6 /* csmtest2.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = csmtest2.c; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -498,6 +503,8 @@
5507A6221E6B8714008B9F73 /* csmtest.c */,
55308C351F921A5600353A68 /* csmtest_array.c */,
55308C361F921A5600353A68 /* csmtest_array.inl */,
55FEB002218FA47100C114A6 /* csmtest2.h */,
55FEB003218FA47100C114A6 /* csmtest2.c */,
557954591E5DB074000FC91E /* Products */,
);
name = Test;
Expand Down Expand Up @@ -893,10 +900,12 @@
5589F1ED2083EBE200526923 /* csmoptree.h in Headers */,
5513277D1ECBA0CC00F2B04D /* csmsetop.h in Headers */,
5517CD9420BC82FE00DA6690 /* csmaulong.h in Headers */,
55FEB004218FA47100C114A6 /* csmtest2.h in Headers */,
551D47601FC1E012004F3B43 /* csmbasicshape2d.h in Headers */,
559452871F79A0E5002AF198 /* csmquadrics.h in Headers */,
5512FD1520B4857D00809018 /* csmeuler_mvfb.inl in Headers */,
5507A62A1E700F7C008B9F73 /* csmeuler_lmef.inl in Headers */,
55FEB00A218FA9B700C114A6 /* csmviewer.inl in Headers */,
5507A6251E6B8714008B9F73 /* csmtest.h in Headers */,
5579548D1E5E41C1000FC91E /* csmedge.inl in Headers */,
557012C11E832F9600DFC490 /* csmmath.inl in Headers */,
Expand Down Expand Up @@ -1071,11 +1080,11 @@
buildActionMask = 2147483647;
files = (
5507A6741E706175008B9F73 /* csmtest.h in Resources */,
55FEB009218FA99C00C114A6 /* csmviewer.inl in Resources */,
55308C3E1F9222B500353A68 /* csmmaterial.inl in Resources */,
551D475C1FC1CED3004F3B43 /* csmshape2d.inl in Resources */,
55A9842C1FBCC9DC009F7516 /* License.txt in Resources */,
5507A6731E70610D008B9F73 /* rGWB.h in Resources */,
5598D6141F24E7F600EA1876 /* csmviewer.inl in Resources */,
557954691E5DB0A8000FC91E /* csmmem.inl in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1109,6 +1118,7 @@
5507A5C61E6624E7008B9F73 /* csmopbas.c in Sources */,
5507A6781E7341CD008B9F73 /* csmeuler_lkemr.c in Sources */,
55EA99231ED38FCD006C063C /* csmsetop_procedges.c in Sources */,
55FEB005218FA47100C114A6 /* csmtest2.c in Sources */,
557012A01E8328E400DFC490 /* csmsweep.c in Sources */,
5579546A1E5DB0A8000FC91E /* csmmem.c in Sources */,
5532DDB81E8FFE810047B9DF /* csmloopglue.c in Sources */,
Expand Down Expand Up @@ -1299,7 +1309,7 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "__STANDALONE_DISTRIBUTABLE=1";
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "RGWB_STANDALONE_DISTRIBUTABLE=1";
INFOPLIST_FILE = rGWB/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
Expand All @@ -1320,7 +1330,7 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "__STANDALONE_DISTRIBUTABLE=1";
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "RGWB_STANDALONE_DISTRIBUTABLE=1";
INFOPLIST_FILE = rGWB/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
Expand Down
2 changes: 1 addition & 1 deletion rGWB/csmarrayc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "csmarqsort.inl"

#ifdef __STANDALONE_DISTRIBUTABLE
#ifdef RGWB_STANDALONE_DISTRIBUTABLE

#include "csmassert.inl"
#include "csmmem.inl"
Expand Down
2 changes: 1 addition & 1 deletion rGWB/csmarrayc.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ DLL_RGWB void csmarrayc_dontuse_invert(struct csmarrayc_t *array);
// Array of pointers to structs...

#define csmarrayc_new_st_array(capacidad_inicial, type) (csmArrayStruct(type) *)csmarrayc_dontuse_new_ptr_array(capacidad_inicial, sizeof(struct type *))
#define csmarrayc_new_const_st_array(capacidad_inicial, type) (const csmArrayStruct(type) *)csmarrayc_dontuse_copy_ptr_array(capacidad_inicial, sizeof(struct type *))
#define csmarrayc_new_const_st_array(capacidad_inicial, type) (const csmArrayStruct(type) *)csmarrayc_dontuse_new_ptr_array(capacidad_inicial, sizeof(struct type *))

#define csmarrayc_copy_st_array(array, type, func_copy_element)\
(/*lint -save -e505*/\
Expand Down
2 changes: 1 addition & 1 deletion rGWB/csmassert.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright (c) 2015 manueru. All rights reserved.
//

#ifdef __STANDALONE_DISTRIBUTABLE
#ifdef RGWB_STANDALONE_DISTRIBUTABLE

#include "csmassert.inl"

Expand Down
2 changes: 1 addition & 1 deletion rGWB/csmassert.inl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Assertion management module.
//

#ifdef __STANDALONE_DISTRIBUTABLE
#ifdef RGWB_STANDALONE_DISTRIBUTABLE

#undef assert
#include "csmfwddecl.hxx"
Expand Down
2 changes: 1 addition & 1 deletion rGWB/csmaulong.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "csmarrayc.h"

#ifdef __STANDALONE_DISTRIBUTABLE
#ifdef RGWB_STANDALONE_DISTRIBUTABLE
#include "csmassert.inl"
#include "csmmem.inl"
#else
Expand Down
2 changes: 1 addition & 1 deletion rGWB/csmbbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "csmmath.inl"
#include "csmmath.tli"

#ifdef __STANDALONE_DISTRIBUTABLE
#ifdef RGWB_STANDALONE_DISTRIBUTABLE
#include "csmassert.inl"
#include "csmmem.inl"
#else
Expand Down
125 changes: 66 additions & 59 deletions rGWB/csmdebug.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#include <basicGraphics/bsgraphics2.h>
#include <basicGraphics/bsgraphics2.tlh>

#ifdef __cplusplus
extern "C" {
#endif

#define i_MAX_NUM_CONTEXTS 100
#define i_MAX_LENGTH_CONTEXT_NAME 256

Expand Down Expand Up @@ -81,20 +85,20 @@
};

static int g_Draw_inters_sector = 0;
struct i_inters_sector_t g_inters_sector;

struct i_segment_t
{
double x1, y1, z1;
double x2, y2, z2;
};

#define i_MAX_NO_SEGMENTS 100000
struct i_inters_sector_t g_inters_sector;

struct i_segment_t
{
double x1, y1, z1;
double x2, y2, z2;
};

#define i_MAX_NO_SEGMENTS 100000

static int g_Draw_segments = 1;
struct i_segment_t g_segments[i_MAX_NO_SEGMENTS];
static int g_no_segments = 0;

static int g_Draw_segments = 1;
struct i_segment_t g_segments[i_MAX_NO_SEGMENTS];
static int g_no_segments = 0;


// --------------------------------------------------------------------------------

Expand Down Expand Up @@ -587,37 +591,37 @@ CSMBOOL csmdebug_draw_face(unsigned long face_id)
return CSMFALSE;
}
}

// --------------------------------------------------------------------------------

void csmdebug_set_draw_segments(CSMBOOL draw)
{
g_Draw_segments = draw;
}

// --------------------------------------------------------------------------------

void csmdebug_clear_segments(void)
{
g_no_segments = 0;
}

// --------------------------------------------------------------------------------

void csmdebug_append_segment(double x1, double y1, double z1, double x2, double y2, double z2)
{
bsassert(g_no_segments < i_MAX_NO_SEGMENTS);

g_segments[g_no_segments].x1 = x1;
g_segments[g_no_segments].y1 = y1;
g_segments[g_no_segments].z1 = z1;

g_segments[g_no_segments].x2 = x2;
g_segments[g_no_segments].y2 = y2;
g_segments[g_no_segments].z2 = z2;

g_no_segments++;
}

// --------------------------------------------------------------------------------

void csmdebug_set_draw_segments(CSMBOOL draw)
{
g_Draw_segments = draw;
}

// --------------------------------------------------------------------------------

void csmdebug_clear_segments(void)
{
g_no_segments = 0;
}

// --------------------------------------------------------------------------------

void csmdebug_append_segment(double x1, double y1, double z1, double x2, double y2, double z2)
{
bsassert(g_no_segments < i_MAX_NO_SEGMENTS);

g_segments[g_no_segments].x1 = x1;
g_segments[g_no_segments].y1 = y1;
g_segments[g_no_segments].z1 = z1;

g_segments[g_no_segments].x2 = x2;
g_segments[g_no_segments].y2 = y2;
g_segments[g_no_segments].z2 = z2;

g_no_segments++;
}

// --------------------------------------------------------------------------------

Expand Down Expand Up @@ -792,25 +796,28 @@ void csmdebug_draw_debug_info(struct bsgraphics2_t *graphics)
x4, y4, z4, true, g_A, g_B, g_C);

bsmaterial_destruye(&material);
}

if (g_Draw_segments == CSMTRUE)
{
struct bsmaterial_t *debug_point_segment;

debug_point_segment = bsmaterial_crea_rgb(1., 0., 0.);
bsgraphics2_escr_color(graphics, debug_point_segment);

bsgraphics2_escr_grosor_linea(graphics, BSGRAPHICS2_GROSOR_MUY_GRUESO);

for (i = 0; i < g_no_segments; i++)
bsgraphics2_escr_linea3D(graphics, g_segments[i].x1, g_segments[i].y1, g_segments[i].z1, g_segments[i].x2, g_segments[i].y2, g_segments[i].z2);

bsmaterial_destruye(&debug_point_segment);
}

if (g_Draw_segments == CSMTRUE)
{
struct bsmaterial_t *debug_point_segment;

debug_point_segment = bsmaterial_crea_rgb(1., 0., 0.);
bsgraphics2_escr_color(graphics, debug_point_segment);

bsgraphics2_escr_grosor_linea(graphics, BSGRAPHICS2_GROSOR_MUY_GRUESO);

for (i = 0; i < g_no_segments; i++)
bsgraphics2_escr_linea3D(graphics, g_segments[i].x1, g_segments[i].y1, g_segments[i].z1, g_segments[i].x2, g_segments[i].y2, g_segments[i].z2);

bsmaterial_destruye(&debug_point_segment);
}

bsmaterial_destruye(&debug_point_material);
}



#ifdef __cplusplus
}
#endif
2 changes: 1 addition & 1 deletion rGWB/csmedge.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "csmvertex.inl"
#include "csmwriteablesolid.tli"

#ifdef __STANDALONE_DISTRIBUTABLE
#ifdef RGWB_STANDALONE_DISTRIBUTABLE
#include "csmassert.inl"
#include "csmmem.inl"
#else
Expand Down
2 changes: 1 addition & 1 deletion rGWB/csmeuler_kvfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "csmloop.inl"
#include "csmsolid.inl"

#ifdef __STANDALONE_DISTRIBUTABLE
#ifdef RGWB_STANDALONE_DISTRIBUTABLE
#include "csmassert.inl"
#else
#include "cyassert.h"
Expand Down
9 changes: 7 additions & 2 deletions rGWB/csmeuler_laringmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@

#include "csmeuler_laringmv.inl"

#include "csmarrayc.h"
#include "csmdebug.inl"
#include "csmface.inl"
#include "csmhedge.inl"
#include "csmloop.inl"
#include "csmvertex.inl"

#ifdef __STANDALONE_DISTRIBUTABLE
#ifdef RGWB_STANDALONE_DISTRIBUTABLE
#include "csmassert.inl"
#else
#include "cyassert.h"
Expand All @@ -29,13 +30,15 @@ void csmeuler_laringmv(
register struct csmloop_t *iterator_face1;
unsigned long no_iterations;
struct csmloop_t *flout_face1;
const csmArrayStruct(csmloop_t) *face1_inner_loops_with_area;

csmface_redo_geometric_generated_data(face1);

iterator_face1 = csmface_floops(face1);
no_iterations = 0;

flout_face1 = csmface_flout(face1);
face1_inner_loops_with_area = csmface_get_inner_loops_with_area(face1);

do
{
Expand All @@ -56,7 +59,7 @@ void csmeuler_laringmv(
vtx = csmhedge_vertex(ledge);
csmvertex_get_coords(vtx, &x, &y, &z);

if (csmface_is_point_interior_to_face(face1, x, y, z, tolerances) == CSMFALSE)
if (csmface_is_point_interior_to_face_optimized_laringmv(face1, face1_inner_loops_with_area, x, y, z, tolerances) == CSMFALSE)
{
csmloop_set_setop_loop_was_a_hole(iterator_face1, CSMTRUE);

Expand All @@ -68,6 +71,8 @@ void csmeuler_laringmv(
iterator_face1 = next_loop;

} while (iterator_face1 != NULL);

csmarrayc_free_const_st(&face1_inner_loops_with_area, csmloop_t);
}

// ------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion rGWB/csmeuler_lkef.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "csmsolid.inl"
#include "csmvertex.inl"

#ifdef __STANDALONE_DISTRIBUTABLE
#ifdef RGWB_STANDALONE_DISTRIBUTABLE
#include "csmassert.inl"
#else
#include "cyassert.h"
Expand Down
2 changes: 1 addition & 1 deletion rGWB/csmeuler_lkemr.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "csmsolid.inl"
#include "csmvertex.inl"

#ifdef __STANDALONE_DISTRIBUTABLE
#ifdef RGWB_STANDALONE_DISTRIBUTABLE
#include "csmassert.inl"
#include "csmmem.inl"
#else
Expand Down
2 changes: 1 addition & 1 deletion rGWB/csmeuler_lkev.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "csmsolid.inl"
#include "csmvertex.inl"

#ifdef __STANDALONE_DISTRIBUTABLE
#ifdef RGWB_STANDALONE_DISTRIBUTABLE
#include "csmassert.inl"
#include "csmmem.inl"
#else
Expand Down
Loading

0 comments on commit 6ff5f80

Please sign in to comment.