3811{
3812 uint64_t i, nedges, nfaces, fields;
3816 int nedge_left = 0;
3818 int nedge_right = 0;
3820 int nnode = 0;
3825 int fnode_edges = 0;
3826
3827 int lnode_edges = 0;
3828
3829
3831
3832 i = 1;
3834 if (!edge)
3835 {
3836 LWDEBUGF(1,
"lwt_be_getEdgeById returned NULL and set i=%d", i);
3837 if (i == UINT64_MAX)
3838 {
3840 return -1;
3841 }
3842 else if (i == 0)
3843 {
3845 return -1;
3846 }
3847 else
3848 {
3850 "Backend coding error: getEdgeById callback returned NULL "
3851 "but numelements output parameter has value %d "
3852 "(expected 0 or 1)",
3853 i);
3854 return -1;
3855 }
3856 }
3857
3860 {
3862 return -1;
3863 }
3864
3865 LWDEBUG(1,
"Updating next_{right,left}_face of ring edges...");
3866
3867
3868
3869 nedges = 0;
3872 {
3873 node_ids[nedges++] = edge->
end_node;
3874 }
3879 if (nedges == UINT64_MAX)
3880 {
3882 return -1;
3883 }
3884 nedge_left = nedge_right = 0;
3885 for ( i=0; i<nedges; ++i )
3886 {
3888 if ( e->
edge_id == edge_id )
continue;
3890 {
3891 ++fnode_edges;
3892 }
3894 {
3895 ++lnode_edges;
3896 }
3898 {
3902 }
3904 {
3908 }
3909
3911 {
3915 }
3917 {
3921 }
3922 }
3923
3924 if ( nedge_left )
3925 {
3926 LWDEBUGF(1,
"updating %d 'next_left' edges", nedge_left);
3927
3929 if (result == -1)
3930 {
3934 return -1;
3935 }
3936 }
3937 if ( nedge_right )
3938 {
3939 LWDEBUGF(1,
"updating %d 'next_right' edges", nedge_right);
3940
3942 if (result == -1)
3943 {
3947 return -1;
3948 }
3949 }
3950 LWDEBUGF(1,
"releasing %d updateable edges in %p", nedges, upd_edge);
3952
3953
3954
3956
3957
3959 {
3961 }
3962 else
3963 {
3964
3966 {
3967 floodface = 0;
3968 LWDEBUG(1,
"floodface is universe");
3969 }
3970 else
3971 {
3972
3973
3976
3979 nfaces = 2;
3982 if (nfaces == UINT64_MAX)
3983 {
3985 return -1;
3986 }
3989 for ( i=0; i<nfaces; ++i )
3990 {
3991 if ( faces[i].face_id == edge->
face_left )
3992 {
3993 if ( ! box1 ) box1 = faces[i].
mbr;
3994 else
3995 {
3999 lwerror(
"corrupted topology: more than 1 face have face_id=%"
4001 return -1;
4002 }
4003 }
4004 else if ( faces[i].face_id == edge->
face_right )
4005 {
4006 if ( ! box2 ) box2 = faces[i].
mbr;
4007 else
4008 {
4012 lwerror(
"corrupted topology: more than 1 face have face_id=%"
4014 return -1;
4015 }
4016 }
4017 else
4018 {
4022 lwerror(
"Backend coding error: getFaceById returned face "
4024 return -1;
4025 }
4026 }
4027 if ( ! box1 ) {
4031 lwerror(
"corrupted topology: no face have face_id=%"
4034 return -1;
4035 }
4036 if ( ! box2 ) {
4040 lwerror(
"corrupted topology: no face have face_id=%"
4043 return -1;
4044 }
4047 if ( modFace )
4048 {
4052 if (result == -1)
4053 {
4056 return -1;
4057 }
4058 if (result != 1)
4059 {
4061 lwerror(
"Unexpected error: %d faces updated when expecting 1", i);
4062 return -1;
4063 }
4064 }
4065 else
4066 {
4067
4071 if (result == -1)
4072 {
4075 return -1;
4076 }
4077 if (result != 1)
4078 {
4080 lwerror(
"Unexpected error: %d faces inserted when expecting 1", result);
4081 return -1;
4082 }
4084 }
4085 }
4086
4087
4088
4089
4091 {
4093 {
4096 return -1;
4097 }
4099 {
4102 return -1;
4103 }
4104 }
4105
4107 {
4109 {
4112 return -1;
4113 }
4115 {
4118 return -1;
4119 }
4120 }
4121
4122
4125 floodface) )
4126 {
4129 return -1;
4130 }
4131 }
4132
4133
4135 if (result == -1)
4136 {
4139 return -1;
4140 }
4141
4142
4143
4144
4145 if ( ! fnode_edges )
4146 {
4149 ++nnode;
4150 }
4152 {
4155 ++nnode;
4156 }
4157 if ( nnode )
4158 {
4160 if (result == -1)
4161 {
4164 return -1;
4165 }
4166 }
4167
4169
4170 {
4172 int nids = 0;
4178 if (result == -1)
4179 {
4182 return -1;
4183 }
4184 }
4185
4187 return modFace ? floodface : newface.
face_id;
4188}
int gbox_merge(const GBOX *new_box, GBOX *merge_box)
Update the merged GBOX to be large enough to include itself and the new box.
LWT_INT64 LWT_ELEMID
Identifier of topology element.
#define LWT_COL_EDGE_START_NODE
#define LWT_COL_EDGE_NEXT_RIGHT
#define LWT_COL_NODE_CONTAINING_FACE
#define LWT_COL_EDGE_EDGE_ID
Edge fields.
#define LWT_COL_EDGE_END_NODE
#define LWT_COL_EDGE_NEXT_LEFT
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static LWT_ISO_EDGE * lwt_be_getEdgeByNode(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
static uint64_t lwt_be_updateFacesById(LWT_TOPOLOGY *topo, const LWT_ISO_FACE *faces, uint64_t numfaces)
static int lwt_be_deleteFacesById(const LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t numelems)
static int lwt_be_checkTopoGeomRemEdge(LWT_TOPOLOGY *topo, LWT_ELEMID edge_id, LWT_ELEMID face_left, LWT_ELEMID face_right)
static int _lwt_UpdateEdgeFaceRef(LWT_TOPOLOGY *topo, LWT_ELEMID of, LWT_ELEMID nf)
LWT_ISO_EDGE * lwt_be_getEdgeById(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
static int lwt_be_updateNodesById(LWT_TOPOLOGY *topo, const LWT_ISO_NODE *nodes, int numnodes, int upd_fields)
static int lwt_be_updateTopoGeomFaceHeal(LWT_TOPOLOGY *topo, LWT_ELEMID face1, LWT_ELEMID face2, LWT_ELEMID newface)
static int lwt_be_insertFaces(LWT_TOPOLOGY *topo, LWT_ISO_FACE *face, uint64_t numelems)
static LWT_ISO_FACE * lwt_be_getFaceById(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
int lwt_be_deleteEdges(LWT_TOPOLOGY *topo, const LWT_ISO_EDGE *sel_edge, int sel_fields)
static int _lwt_UpdateNodeFaceRef(LWT_TOPOLOGY *topo, LWT_ELEMID of, LWT_ELEMID nf)
static void _lwt_release_faces(LWT_ISO_FACE *faces, int num_faces)
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
static void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
static int lwt_be_updateEdgesById(LWT_TOPOLOGY *topo, const LWT_ISO_EDGE *edges, int numedges, int upd_fields)
LWT_ELEMID containing_face
const LWT_BE_IFACE * be_iface