42 if ( !
mesh->npnil )
return 0;
46 ppt = &
mesh->point[curpt];
47 memcpy(ppt->
c,c,2*
sizeof(
double));
60 ppt = &
mesh->point[ip];
67 if ( ip ==
mesh->np ) {
75 pt = &
mesh->edge[iel];
77 fprintf(stdout,
" ## INVALID EDGE.\n");
95 mesh->nenil =
mesh->tria[curiel].v[2];
96 mesh->tria[curiel].v[2] = 0;
97 mesh->tria[curiel].ref = 0;
98 mesh->tria[curiel].base = 0;
99 mesh->tria[curiel].edg[0] = 0;
100 mesh->tria[curiel].edg[1] = 0;
101 mesh->tria[curiel].edg[2] = 0;
111 pt = &
mesh->tria[iel];
113 fprintf(stdout,
" ## INVALID ELEMENT.\n");
117 pt->
v[2] =
mesh->nenil;
119 iadr = (iel-1)*3 + 1;
121 memset(&
mesh->adja[iadr],0,3*
sizeof(MMG5_int));
124 if ( iel ==
mesh->nt ) {
147 size_t usedMem,avMem,reservedMem,npadd;
160 if ( usedMem >
mesh->memMax ) {
161 fprintf(stderr,
"\n ## Error: %s: %zu MB of memory ",__func__,
163 fprintf(stderr,
"is not enough to load mesh. You need to ask %zu MB minimum\n",
173 2*
sizeof(
MMG5_Tria) + 3*2*
sizeof(MMG5_int)
174 + 0.2*
sizeof(
MMG5_Edge) + 3*
sizeof(double);
176 avMem =
mesh->memMax-usedMem;
181 npadd = avMem/(2*bytes);
186 if (
sizeof(MMG5_int) ==
sizeof(int32_t) ) {
199 int32_t int32_ntmax = (INT32_MAX-(coef+1))/coef;
201 if ( int32_ntmax < mesh->ntmax ) {
202 if ( int32_ntmax <= mesh->nt ) {
204 fprintf(stderr,
"\n ## Error: %s: with %" MMG5_PRId
" triangles Mmg will overflow"
205 " the 32-bit integer.\n",__func__,
mesh->nt);
206 fprintf(stderr,
"Please, configure Mmg with MMG5_INT=int64_t argument.\n");
211 mesh->ntmax = int32_ntmax;
216 if ( abs(
mesh->info.imprim) > 4 ||
mesh->info.ddebug ) {
217 fprintf(stdout,
" MAXIMUM MEMORY AUTHORIZED (MB) %zu\n",
221 if ( abs(
mesh->info.imprim) > 5 ||
mesh->info.ddebug ) {
222 fprintf(stdout,
" MMG2D_NPMAX %" MMG5_PRId
"\n",
mesh->npmax);
223 fprintf(stdout,
" MMG2D_NTMAX %" MMG5_PRId
"\n",
mesh->ntmax);
260 printf(
" Exit program.\n");
284 for (k=
mesh->npnil; k<mesh->npmax-1; k++) {
286 mesh->point[k].n[0] = 0;
287 mesh->point[k].n[1] = 0;
288 mesh->point[k].n[2] = 0;
290 mesh->point[k].tmp = k+1;
293 for (k=
mesh->nenil; k<mesh->ntmax-1; k++)
294 mesh->tria[k].v[2] = k+1;
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
size_t MMG5_memSize(void)
void MMG5_memOption_memSet(MMG5_pMesh mesh)
#define MMG5_ADD_MEM(mesh, size, message, law)
Structure to store edges of am MMG mesh.
Structure to store vertices of an MMG mesh.
Structure to store quadrangles of an MMG mesh.
Structure to store triangles of a MMG mesh.
void MMG5_delEdge(MMG5_pMesh mesh, MMG5_int iel)
int MMG2D_memOption(MMG5_pMesh mesh)
static int MMG2D_memOption_memSet(MMG5_pMesh mesh)
int MMG2D_zaldy(MMG5_pMesh mesh)
MMG5_int MMG2D_newPt(MMG5_pMesh mesh, double c[2], uint16_t tag)
int MMG2D_delElt(MMG5_pMesh mesh, MMG5_int iel)
void MMG2D_delPt(MMG5_pMesh mesh, MMG5_int ip)
int MMG2D_setMeshSize_alloc(MMG5_pMesh mesh)
MMG5_int MMG2D_newElt(MMG5_pMesh mesh)