43 if ( !
mesh->npnil )
return 0;
47 ppt = &
mesh->point[curpt];
48 memcpy(ppt->
c,c,3*
sizeof(
double));
50 memcpy(ppt->
n,n,3*
sizeof(
double));
61 ppt = &
mesh->point[ip];
66 if ( ip ==
mesh->np ) {
74 if ( !
mesh->nenil )
return 0;
78 mesh->nenil =
mesh->tria[curiel].v[2];
79 mesh->tria[curiel].v[2] = 0;
96 pt = &
mesh->tria[iel];
98 fprintf(stderr,
"\n ## INVALID ELEMENT %" MMG5_PRId
".\n",iel);
102 pt->
v[2] =
mesh->nenil;
104 memset(&
mesh->adja[3*(iel-1)+1],0,3*
sizeof(MMG5_int));
106 if ( iel ==
mesh->nt ) {
129 size_t usedMem,avMem,reservedMem,npadd;
140 + (
mesh->np+1)*
sizeof(
double);
142 if ( usedMem >
mesh->memMax ) {
143 fprintf(stderr,
"\n ## Error: %s: %zu MB of memory ",__func__,
mesh->memMax/
MMG5_MILLION);
144 fprintf(stderr,
"is not enough to load mesh. You need to ask %zu MB minimum\n",
151 2*
sizeof(
MMG5_Tria) + 3*
sizeof(MMG5_int) + 6*
sizeof(double);
153 avMem =
mesh->memMax-usedMem;
158 npadd = avMem/(2*bytes);
162 if (
sizeof(MMG5_int) ==
sizeof(int32_t) ) {
167 int32_t int32_ntmax = (INT32_MAX-(coef+1))/coef;
169 if ( int32_ntmax < mesh->ntmax ) {
170 if ( int32_ntmax <= mesh->nt ) {
172 fprintf(stderr,
"\n ## Error: %s: with %" MMG5_PRId
" triangles Mmg will overflow"
173 " the 32-bit integer.\n",__func__,
mesh->nt);
174 fprintf(stderr,
"Please, configure Mmg with MMG5_INT=int64_t argument.\n");
179 mesh->ntmax = int32_ntmax;
184 if ( abs(
mesh->info.imprim) > 4 ||
mesh->info.ddebug ) {
185 fprintf(stdout,
" MAXIMUM MEMORY AUTHORIZED (MB) %zu\n",
189 if ( abs(
mesh->info.imprim) > 5 ||
mesh->info.ddebug ) {
190 fprintf(stdout,
" MMG2D_NPMAX %" MMG5_PRId
"\n",
mesh->npmax);
191 fprintf(stdout,
" MMG2D_NTMAX %" MMG5_PRId
"\n",
mesh->ntmax);
227 fprintf(stderr,
" Exit program.\n");
231 fprintf(stderr,
" Exit program.\n");
246 for (k=
mesh->npnil; k<mesh->npmax-1; k++)
247 mesh->point[k].tmp = k+1;
249 for (k=
mesh->nenil; k<mesh->ntmax-1; k++)
250 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 triangles of a MMG mesh.
Structure to store surface vertices of an MMG mesh.
MMG5_int MMGS_newPt(MMG5_pMesh mesh, double c[3], double n[3])
int MMGS_delElt(MMG5_pMesh mesh, MMG5_int iel)
int MMGS_zaldy(MMG5_pMesh mesh)
int MMGS_setMeshSize_alloc(MMG5_pMesh mesh)
static int MMGS_memOption_memSet(MMG5_pMesh mesh)
void MMGS_delPt(MMG5_pMesh mesh, MMG5_int ip)
int MMGS_memOption(MMG5_pMesh mesh)
MMG5_int MMGS_newElt(MMG5_pMesh mesh)