Debian Codegraph @

dune/uggrid/parallel/dddif/identify.cc

raw
1 // SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2 // SPDX-License-Identifier: LGPL-2.1-or-later
3 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 // vi: set et ts=4 sw=2 sts=2:
5 /****************************************************************************/
6 /* */
7 /* File: identify.c */
8 /* */
9 /* Purpose: identification of distributed ug objects */
10 /* */
11 /* Author: Stefan Lang */
12 /* Institut fuer Computeranwendungen III */
13 /* Universitaet Stuttgart */
14 /* Pfaffenwaldring 27 */
15 /* 70550 Stuttgart */
16 /* email: [email protected] */
17 /* */
18 /* History: 26.11.96 begin, first version extracted from refine.c */
19 /* */
20 /* Remarks: */
21 /* */
22 /****************************************************************************/
23
24 #ifdef ModelP
25
26 /****************************************************************************/
27 /* */
28 /* include files */
29 /* system include files */
30 /* application include files */
31 /* */
32 /****************************************************************************/
33
34 #include <config.h>
35 #include <cstdio>
36
37 #include <dune/uggrid/ugdevices.h>
38
39 #include <dune/uggrid/gm/gm.h>
40 #include <dune/uggrid/gm/refine.h>
41 #include <dune/uggrid/gm/rm.h>
42 #include <dune/uggrid/gm/ugm.h>
43 #include <dune/uggrid/low/debug.h>
44 #include <dune/uggrid/low/ugtypes.h>
45
46 #include <dune/uggrid/parallel/ddd/include/ddd.h>
47 #include "identify.h"
48 #include "parallel.h"
49
50 /* UG namespaces: */
51 USING_UG_NAMESPACES
52
53 /* PPIF namespace: */
54 using namespace PPIF;
55
56 /****************************************************************************/
57 /* */
58 /* defines in the following order */
59 /* */
60 /* compile time constants defining static data size (i.e. arrays) */
61 /* other constants */
62 /* macros */
63 /* */
64 /****************************************************************************/
65
66 /* flags for identification */
67 enum {CLEAR = 0,
68 IDENT = 1};
69
70 /* maximum count of objects for identification */
71 #define MAX_OBJECT 3
72
73 /* maximum count of tokens for identification */
74 #define MAX_TOKEN 10
75
76 /* determine the ddd header for identification of a node */
77 #define NIDENT_HDR(node) ( (CORNERTYPE(node)) ? \
78 PARHDR((NODE *)NFATHER(node)) : PARHDR(node) )
79
80 /* mapping of flags used for identification */
81 #define NIDENT(p) THEFLAG(p)
82 #define SETNIDENT(p,n) SETTHEFLAG(p,n)
83
84 #define EDIDENT(p) THEFLAG(p)
85 #define SETEDIDENT(p,n) SETTHEFLAG(p,n)
86
87 /* strong checking of identification (0=off 1==on) */
88 #define NIDENTASSERT 1
89 #define EDIDENTASSERT 1
90
91 /****************************************************************************/
92 /* */
93 /* data structures used in this source file (exported data structures are */
94 /* in the corresponding include file!) */
95 /* */
96 /****************************************************************************/
97
98
99
100 /****************************************************************************/
101 /* */
102 /* definition of exported global variables */
103 /* */
104 /****************************************************************************/
105
106 INT NS_DIM_PREFIX ident_mode = IDENT_OFF;
107
108 /****************************************************************************/
109 /* */
110 /* definition of variables global to this source file only (static!) */
111 /* */
112 /****************************************************************************/
113
114
115 /* this function is called for low level identification */
116 static INT (*Ident_FctPtr)(DDD::DDDContext& context, DDD_HDR *IdentObjectHdr, INT nobject,
117 const DDD_InfoProcListRange& proclist, DDD_PRIO skiptag, DDD_HDR *IdentHdr, INT nident) = NULL;
118
119 static int check_nodetype = 0;
120
121 #ifdef Debug
122 static INT debug = 0;
123 static INT identlevel = 0;
124 #endif
125
126 /****************************************************************************/
127 /* */
128 /* forward declarations of functions used before they are defined */
129 /* */
130 /****************************************************************************/
131
132
133 /****************************************************************************/
134 /*
135 ResetIdentFlags -
136
137 SYNOPSIS:
138 static void ResetIdentFlags (GRID *UpGrid);
139
140 PARAMETERS:
141 . UpGrid
142
143 DESCRIPTION:
144
145 RETURN VALUE:
146 void
147 */
148 /****************************************************************************/
149
150 static void ResetIdentFlags (GRID *Grid)
151 {
152 /* clear all IDENT flags */
153 for (NODE* theNode=FIRSTNODE(Grid); theNode!=NULL; theNode=SUCCN(theNode))
154 {
155 SETNIDENT(theNode,CLEAR);
156 SETUSED(theNode,0);
157
158 for (LINK* theLink=START(theNode); theLink!=NULL; theLink=NEXT(theLink))
159 {
160 EDGE* theEdge = MYEDGE(theLink);
161 SETEDIDENT(theEdge,CLEAR);
162 }
163 }
164 }
165
166 #ifdef Debug
167
168
169 /****************************************************************************/
170 /*
171 Print_Identify_ObjectList -
172
173 SYNOPSIS:
174 static INT Print_Identify_ObjectList (DDD_HDR *IdentObjectHdr, INT nobject,
175 const DDD_InfoProcListRange& proclist, DDD_PRIO skiptag, DDD_HDR *IdentHdr, INT nident);
176
177 PARAMETERS:
178 . IdentObjectHdr
179 . nobject
180 . proclist
181 . skiptag
182 . IdentHdr
183 . nident
184
185 DESCRIPTION:
186
187 RETURN VALUE:
188 INT
189 */
190 /****************************************************************************/
191
192 static INT Print_Identify_ObjectList (DDD_HDR *IdentObjectHdr, INT nobject,
193 const DDD_InfoProcListRange& proclist, DDD_PRIO skiptag, DDD_HDR *IdentHdr, INT nident)
194 {
195 ASSERT(nobject>0);
196 ASSERT(nident>0);
197 ASSERT(!proclist.empty());
198
199 /* print the interesting call parameters */
200 PrintDebug ("%d: Print_Identify_ObjectList(): nobject=%d nident=%d"
201 " skiptag=%d\n",me,nobject,nident,skiptag);
202
203 /* print line prefix */
204 PrintDebug ("%d: l=%d",me,identlevel);
205
206 /* print the objects used for identify */
207 PrintDebug (" IdentHdr:");
208 for (INT i=0; i<nident; i++)
209 PrintDebug (" %d",DDD_InfoGlobalId(IdentHdr[i]));
210
211 /* print type of objects to identify */
212 PrintDebug (" IdentObjectType:");
213 for (INT i=0; i<nobject; i++)
214 PrintDebug (" %d",DDD_InfoType(IdentObjectHdr[i]));
215
216 /* print the proclist to identify to */
217 PrintDebug (" ProcList: %d",me);
218 for (auto&& [proc, prio] : proclist)
219 {
220 if (prio == skiptag)
221 continue;
222
223 PrintDebug (" %d", proc);
224 }
225
226 /* print my processor number */
227 PrintDebug (" me:%d",me);
228
229 /* print the objects to identify */
230 PrintDebug (" IdentObjectHdr:");
231 for (INT i=0; i<nobject; i++)
232 PrintDebug (" %d",DDD_InfoGlobalId(IdentObjectHdr[i]));
233
234 PrintDebug ("\n");
235
236 return 0;
237
238 }
239 #endif
240
241 #ifdef Debug
242
243
244 /****************************************************************************/
245 /*
246 Print_Identified_ObjectList -
247
248 SYNOPSIS:
249 static INT Print_Identified_ObjectList (DDD_HDR *IdentObjectHdr, INT nobject, const DDD_InfoProcListRange& proclist, DDD_PRIO skiptag, DDD_HDR *IdentHdr, INT nident);
250
251 PARAMETERS:
252 . IdentObjectHdr
253 . nobject
254 . proclist
255 . skiptag
256 . IdentHdr
257
258 DESCRIPTION:
259
260 RETURN VALUE:
261 INT
262 */
263 /****************************************************************************/
264
265 static INT Print_Identified_ObjectList (DDD_HDR *IdentObjectHdr, INT nobject,
266 const DDD_InfoProcListRange& proclist, DDD_PRIO skiptag, DDD_HDR *IdentHdr, INT nident)
267 {
268 ASSERT(nobject>0);
269 ASSERT(nident>0);
270 ASSERT(!proclist.empty());
271
272 /* print the interesting call parameters */
273 PrintDebug ("%d: Print_Identified_ObjectList(): nobject=%d nident=%d"
274 " skiptag=%d\n",me,nobject,nident,skiptag);
275
276 /* print the objects to identify */
277 PrintDebug ("%d: l=%d IdentObjectHdr:",me,identlevel);
278 for (INT i=0; i<nobject; i++)
279 PrintDebug (" %d",DDD_InfoGlobalId(IdentObjectHdr[i]));
280
281 /* print the objects used for identify */
282 PrintDebug (" IdentHdr:");
283 for (INT i=0; i<nident; i++)
284 PrintDebug (" %d",DDD_InfoGlobalId(IdentHdr[i]));
285
286 /* print the proclist to identify to */
287 PrintDebug (" ProcList: %d",me);
288 for (auto&& [proc, prio] : proclist)
289 {
290 if (prio == skiptag)
291 continue;
292
293 PrintDebug (" %d", proc);
294 }
295
296 /* print my processor number */
297 PrintDebug (" me:%d",me);
298
299 /* print type of objects to identify */
300 PrintDebug (" IdentObjectType:");
301 for (INT i=0; i<nobject; i++)
302 PrintDebug (" %d",DDD_InfoType(IdentObjectHdr[i]));
303
304 PrintDebug ("\n");
305
306 return 0;
307 }
308 #endif
309
310
311
312 /****************************************************************************/
313 /*
314 Identify_by_ObjectList -
315
316 SYNOPSIS:
317 static INT Identify_by_ObjectList (DDD_HDR *IdentObjectHdr, INT nobject,
318 const DDD_InfoProcListRange& proclist, DDD_PRIO skiptag, DDD_HDR *IdentHdr, INT nident);
319
320 PARAMETERS:
321 . IdentObjectHdr
322 . nobject
323 . proclist
324 . skiptag
325 . IdentHdr
326 . nident
327
328 DESCRIPTION:
329
330 RETURN VALUE:
331 INT
332 */
333 /****************************************************************************/
334
335 static INT Identify_by_ObjectList (DDD::DDDContext& context, DDD_HDR *IdentObjectHdr, INT nobject,
336 const DDD_InfoProcListRange& proclist, DDD_PRIO skiptag, DDD_HDR *IdentHdr, INT nident)
337 {
338 ASSERT(nobject>0);
339 ASSERT(nident>0);
340 ASSERT(!proclist.empty());
341
342 #ifdef Debug
343 IFDEBUG(dddif,1)
344 Print_Identify_ObjectList(IdentObjectHdr,nobject,proclist,skiptag,
345 IdentHdr,nident);
346 ENDDEBUG
347 #endif
348
349 INT n = 0;
350 for (auto&& [proc, prio] : proclist)
351 {
352 ASSERT(n < context.procs());
353
354 if (prio == skiptag)
355 continue;
356
357 /* identify the object */
358 for (INT j=0; j<nobject; j++)
359 {
360 for (INT i=0; i<nident; i++)
361 {
362 PRINTDEBUG(dddif,5,("%d: Identify_by_ObjectList(): Type=%d"
363 " IdentObjectHdr=%08x proc=%d IdentHdr=%08x me=%d\n",
364 me,DDD_InfoType(IdentObjectHdr[j]),
365 DDD_InfoGlobalId(IdentObjectHdr[j]),
366 proc,DDD_InfoGlobalId(IdentHdr[i]),me));
367
368 /* hand identification hdr to ddd */
369 DDD_IdentifyObject(context, IdentObjectHdr[j], proc, IdentHdr[i]);
370 }
371 }
372
373 n++;
374 assert(n < context.procs());
375 }
376
377 /* identification should occur to at least one other proc */
378 ASSERT(n>0);
379
380 return 0;
381 }
382
383 #ifdef UG_DIM_3
384
385
386 static void IdentifySideVector (DDD::DDDContext& context, ELEMENT* theElement, ELEMENT *theNeighbor,
387 ELEMENT *Son, INT SonSide)
388 {
389 INT nident = 0;
390 DDD_HDR IdentObjectHdr[MAX_OBJECT];
391 DDD_HDR IdentHdr[MAX_TOKEN];
392
393 IdentObjectHdr[0] = PARHDR(SVECTOR(Son,SonSide));
394
395 /* identify using corner nodes */
396 for (INT k=0; k<CORNERS_OF_SIDE(Son,SonSide); k++)
397 {
398 NODE* theNode = CORNER(Son,CORNER_OF_SIDE(Son,SonSide,k));
399 if (CORNERTYPE(theNode))
400 IdentHdr[nident++] = PARHDR((NODE *)NFATHER(theNode));
401 else
402 IdentHdr[nident++] = PARHDR(theNode);
403 }
404
405 const auto& proclist = DDD_InfoProcListRange(context, PARHDRE(theNeighbor), false);
406
407 Ident_FctPtr(context, IdentObjectHdr,1,proclist,PrioHGhost,IdentHdr,nident);
408
409 }
410 #endif
411
412
413 /****************************************************************************/
414 /*
415 IdentifyNode -
416
417 SYNOPSIS:
418 static void IdentifyNode (ELEMENT *theNeighbor, NODE *theNode,
419 NODE *Nodes[MAX_SIDE_NODES], INT node, INT ncorners);
420
421 PARAMETERS:
422 . theNeighbor
423 . theNode
424 . Nodes[MAX_SIDE_NODES]
425 . node
426 . ncorners
427
428 DESCRIPTION:
429
430 RETURN VALUE:
431 void
432 */
433 /****************************************************************************/
434
435 static void IdentifyNode (GRID *theGrid, ELEMENT *theNeighbor, NODE *theNode,
436 NODE *Nodes[MAX_SIDE_NODES], INT node, INT ncorners)
437 {
438 auto& context = theGrid->dddContext();
439
440 INT nobject,nident;
441 DDD_HDR IdentObjectHdr[MAX_OBJECT];
442 DDD_HDR IdentHdr[MAX_TOKEN];
443
444 nobject = nident = 0;
445
446 /* is this node identified? */
447 #ifdef Debug
448 if (debug == 1) {
449 if (NIDENT(theNode) == CLEAR) return;
450 }
451 else
452 #endif
453
454 /* return if not needed any more */
455 if (!USED(theNode)) return;
456
457 /* return if already identified */
458 if (NIDENT(theNode) == IDENT) return;
459
460 /* only new created nodes are identified */
461 if (!NEW_NIDENT(theNode)) return;
462
463 switch (NTYPE(theNode))
464 {
465
466 case (CORNER_NODE) :
467 {
468
469 /* identification of cornernodes is done */
470 /* in Identify_SonNodes() */
471 return;
472
473 PRINTDEBUG(dddif,1,("%d: Identify CORNERNODE gid=%08x node=%d\n",
474 me, DDD_InfoGlobalId(PARHDR(theNode)), node));
475
476 IdentObjectHdr[nobject++] = PARHDR(theNode);
477
478 /* identify to proclist of node */
479 const auto& proclist = DDD_InfoProcListRange(context, PARHDR((NODE *)NFATHER(theNode)), false);
480
481 /* identify using father node */
482 IdentHdr[nident++] = PARHDR((NODE *)NFATHER(theNode));
483
484 Ident_FctPtr(context, IdentObjectHdr, nobject,
485 proclist, PrioHGhost, IdentHdr, nident);
486
487 break;
488 }
489
490 case (MID_NODE) :
491 {
492 #ifdef UG_DIM_2
493 NODE **EdgeNodes = Nodes;
494 #endif
495
496 EDGE *theEdge;
497 #ifdef UG_DIM_3
498 NODE *EdgeNodes[MAX_SIDE_NODES];
499
500 /* identification of cornernodes is done */
501 /* in Identify_SonEdges() */
502 return;
503
504 EdgeNodes[0] = Nodes[node-ncorners];
505 EdgeNodes[1] = Nodes[(node-ncorners+1)%ncorners];
506 EdgeNodes[2] = theNode;
507 #endif
508
509 ASSERT(EdgeNodes[0]!=NULL);
510 ASSERT(EdgeNodes[1]!=NULL);
511 ASSERT(EdgeNodes[2]!=NULL);
512
513 PRINTDEBUG(dddif,1,("%d: Identify MIDNODE gid=%08x node=%d\n",
514 me, DDD_InfoGlobalId(PARHDR(theNode)), node));
515
516 /* identify midnode, vertex, vector */
517 IdentObjectHdr[nobject++] = PARHDR(theNode);
518 IdentObjectHdr[nobject++] = PARHDRV(MYVERTEX(theNode));
519
520 #ifdef UG_DIM_2
521 if (!NEW_NIDENT(theNode)) break;
522 #endif
523
524 /* Identify to proclist of edge */
525 theEdge = GetEdge((NODE *)NFATHER(EdgeNodes[0]),
526 (NODE *)NFATHER(EdgeNodes[1]));
527 ASSERT(theEdge!=NULL);
528
529 const auto& proclist = DDD_InfoProcListRange(context, PARHDR(theEdge), false);
530
531 /* identify using edge nodes */
532 IdentHdr[nident++] = PARHDR((NODE *)NFATHER(EdgeNodes[0]));
533 IdentHdr[nident++] = PARHDR((NODE *)NFATHER(EdgeNodes[1]));
534
535 /* this is the buggy case
536 IdentHdr[nident++] = PARHDR(EdgeNodes[0]);
537 IdentHdr[nident++] = PARHDR(EdgeNodes[1]);
538 */
539
540 Ident_FctPtr(context, IdentObjectHdr, nobject,
541 proclist, PrioHGhost, IdentHdr, nident);
542
543 break;
544 }
545
546 #ifdef UG_DIM_3
547 case (SIDE_NODE) :
548 {
549 PRINTDEBUG(dddif,1,("%d: Identify SIDENODE gid=%08x node=%d\n",
550 me,DDD_InfoGlobalId(PARHDR(theNode)),node));
551
552 /* identify sidenode and vertex */
553 IdentObjectHdr[nobject++] = PARHDR(theNode);
554 IdentObjectHdr[nobject++] = PARHDRV(MYVERTEX(theNode));
555
556 /* identify to proclist of neighbor element */
557 const auto& proclist = DDD_InfoProcListRange(context, PARHDRE(theNeighbor), false);
558
559 /* identify using corner nodes of side */
560 for (INT i=0; i<ncorners; i++)
561 IdentHdr[nident++] = PARHDR((NODE *)NFATHER(Nodes[i]));
562
563 /* identify side node */
564 Ident_FctPtr(context, IdentObjectHdr, nobject,
565 proclist, PrioHGhost, IdentHdr, nident);
566
567 break;
568 }
569 #endif
570 default :
571 ASSERT(0);
572 break;
573 }
574
575 #ifdef Debug
576 if (debug == 1) {
577 SETNIDENT(theNode,CLEAR);
578 }
579 else
580 #endif
581 /* lock this node for identification */
582 SETNIDENT(theNode,IDENT);
583 }
584
585
586
587 /****************************************************************************/
588 /*
589 IdentifySideEdge - idenify edge shared only between two neighbor elements
590
591 SYNOPSIS:
592 static INT IdentifySideEdge (GRID *theGrid, EDGE *theEdge, ELEMENT *theElement, ELEMENT *theNeighbor, INT Vec);
593
594 PARAMETERS:
595 . theGrid
596 . theNeighbor
597 . theEdge
598 . Vec
599
600 DESCRIPTION:
601
602 RETURN VALUE:
603 INT
604 */
605 /****************************************************************************/
606
607 static INT IdentifySideEdge (GRID *theGrid, EDGE *theEdge, ELEMENT *theElement, ELEMENT *theNeighbor, INT Vec)
608 {
609 INT nobject = 0, nident = 0;
610 DDD_HDR IdentObjectHdr[MAX_OBJECT];
611 DDD_HDR IdentHdr[MAX_TOKEN];
612 auto& context = theGrid->dddContext();
613
614 #ifdef UG_DIM_2
615 /* no identfication to nonrefined neighbors */
616 if (MARK(theNeighbor) == NO_REFINEMENT) return(0);
617 #endif
618
619 #ifdef UG_DIM_3
620 /* identification of sonedges is done in Identify_SonEdges() */
621 {
622 EDGE* FatherEdge = GetFatherEdge(theEdge);
623 if (FatherEdge != NULL) return(0);
624 }
625 #endif
626
627 /* only newly created edges are identified */
628 if (!NEW_EDIDENT(theEdge)) return(0);
629
630 /* edge unlocked -> no debugging occurs */
631 #ifdef Debug
632 if (debug == 1) {
633 if (EDIDENT(theEdge) == CLEAR) return(0);
634 }
635 else
636 #endif
637
638 /* edge locked -> already identified */
639 if (EDIDENT(theEdge) == IDENT) return(0);
640
641 #ifdef UG_DIM_3
642 IdentObjectHdr[nobject++] = PARHDR(theEdge);
643 #endif
644
645 /* identify to proclist of neighbor */
646 const auto& proclist = DDD_InfoProcListRange(context, PARHDRE(theNeighbor), false);
647
648 /* now choose identificator objects */
649 NODE* theNode0 = NBNODE(LINK0(theEdge));
650 NODE* theNode1 = NBNODE(LINK1(theEdge));
651 ASSERT(!CENTERTYPE(theNode0));
652 ASSERT(!CENTERTYPE(theNode1));
653
654 if (CORNERTYPE(theNode0))
655 {
656 ASSERT(NFATHER(theNode0)!=NULL);
657 IdentHdr[nident++] = PARHDR((NODE *)NFATHER(theNode0));
658 }
659 #ifdef UG_DIM_3
660 /* since midnodes are identified later in Debug case */
661 /* choose fatheredge here (s.l. 980227) */
662 else if (MIDTYPE(theNode0))
663 {
664 ASSERT(NFATHER(theNode0)!=NULL);
665 IdentHdr[nident++] = PARHDR((EDGE *)NFATHER(theNode0));
666 }
667 #endif
668 else
669 {
670 /* side node */
671 #ifdef UG_DIM_3
672 ASSERT(SIDETYPE(theNode0));
673 #endif
674 IdentHdr[nident++] = PARHDR(theNode0);
675 }
676
677 if (CORNERTYPE(theNode1))
678 {
679 ASSERT(NFATHER(theNode1)!=NULL);
680 IdentHdr[nident++] = PARHDR((NODE *)NFATHER(theNode1));
681 }
682 #ifdef UG_DIM_3
683 /* since midnodes are identified later in Debug case */
684 /* choose fatheredge here (s.l. 980227) */
685 else if (MIDTYPE(theNode1))
686 {
687 ASSERT(NFATHER(theNode1)!=NULL);
688 IdentHdr[nident++] = PARHDR((EDGE *)NFATHER(theNode1));
689 }
690 #endif
691 else
692 {
693 /* side node */
694 #ifdef UG_DIM_3
695 ASSERT(SIDETYPE(theNode1));
696 #endif
697 IdentHdr[nident++] = PARHDR(theNode1);
698 }
699
700 if (nobject > 0)
701 Ident_FctPtr(context, IdentObjectHdr, nobject,
702 proclist, PrioHGhost, IdentHdr, nident);
703
704 /* debugging unlocks the edge */
705 #ifdef Debug
706 if (debug == 1) {
707 SETEDIDENT(theEdge,CLEAR);
708 }
709 else
710 #endif
711 /* lock this edge for identification */
712 SETEDIDENT(theEdge,IDENT);
713
714 return 0;
715 }
716
717 /****************************************************************************/
718 /*
719 IdentifyEdge -
720
721 SYNOPSIS:
722 static INT IdentifyEdge (ELEMENT *theElement, ELEMENT *theNeighbor,
723 NODE **SideNodes, INT ncorners, ELEMENT *Son, INT SonSide, INT edgeofside, INT Vec);
724
725 PARAMETERS:
726 . theElement
727 . theNeighbor
728 . SideNodes
729 . ncorners
730 . Son
731 . SonSide
732 . edgeofside
733 . Vec
734
735 DESCRIPTION:
736
737 RETURN VALUE:
738 INT
739 */
740 /****************************************************************************/
741
742 static INT IdentifyEdge (GRID *theGrid,
743 ELEMENT *theElement, ELEMENT *theNeighbor,
744 NODE **SideNodes, INT ncorners, ELEMENT *Son,
745 INT SonSide, INT edgeofside, INT Vec)
746 {
747 NODE *Nodes[2];
748 EDGE *theEdge;
749 INT nobject,nident;
750 #ifdef UG_DIM_3
751 INT edge,corner0,corner1;
752 #endif
753 DDD_HDR IdentObjectHdr[MAX_OBJECT];
754 DDD_HDR IdentHdr[MAX_TOKEN];
755 auto& context = theGrid->dddContext();
756
757 nobject = nident = 0;
758
759 #ifdef UG_DIM_2
760 Nodes[0] = CORNER(Son,CORNER_OF_EDGE(Son,SonSide,0));
761 Nodes[1] = CORNER(Son,CORNER_OF_EDGE(Son,SonSide,1));
762 #endif
763
764 #ifdef UG_DIM_3
765 edge = EDGE_OF_SIDE(Son,SonSide,edgeofside);
766 corner0 = CORNER_OF_EDGE(Son,edge,0);
767 corner1 = CORNER_OF_EDGE(Son,edge,1);
768
769 Nodes[0] = CORNER(Son,corner0);
770 Nodes[1] = CORNER(Son,corner1);
771 PRINTDEBUG(dddif,5,("%4d: edge=%d corner0=%d corner1=%d Nodes[0]=%d "
772 "Nodes[1]=%d\n",
773 me,edge, corner0, corner1, ID(Nodes[0]), ID(Nodes[1])));
774 #endif
775
776 ASSERT(Nodes[0]!=NULL);
777 ASSERT(Nodes[1]!=NULL);
778
779 theEdge = GetEdge(Nodes[0],Nodes[1]);
780 ASSERT(theEdge!=NULL);
781
782 #ifdef UG_DIM_2
783 /* no identfication to nonrefined neighbors */
784 if (MARK(theNeighbor) == NO_REFINEMENT) return(0);
785 #endif
786
787 #ifdef UG_DIM_3
788 /* identification of sonedges is done in Identify_SonEdges() */
789 if (0)
790 if (CORNERTYPE(Nodes[0]) && CORNERTYPE(Nodes[1]))
791 {
792 [[maybe_unused]] EDGE *FatherEdge;
793 FatherEdge = GetEdge((NODE *)NFATHER(Nodes[0]),(NODE *)NFATHER(Nodes[1]));
794 ASSERT(FatherEdge != NULL);
795 return(0);
796 /*
797 if (FatherEdge != NULL) return(0);
798 */
799 }
800 {
801 EDGE *FatherEdge;
802 FatherEdge = GetFatherEdge(theEdge);
803 if (FatherEdge != NULL) return(0);
804 }
805 #endif
806
807 /* only newly created edges are identified */
808 if (!NEW_EDIDENT(theEdge)) return(0);
809
810 /* edge unlocked -> no debugging occurs */
811 #ifdef Debug
812 if (debug == 1) {
813 if (EDIDENT(theEdge) == CLEAR) return(0);
814 }
815 else
816 #endif
817
818 /* edge locked -> already identified */
819 if (EDIDENT(theEdge) == IDENT) return(0);
820
821 PRINTDEBUG(dddif,1,("%d: Identify EDGE edgeofside=%d pe=%08x/%x eID=%d"
822 " ntype0=%d ntype1=%d Vec=%d\n",me,edgeofside,
823 DDD_InfoGlobalId(PARHDRE(Son)),Son,ID(Son),
824 NTYPE(Nodes[0]), NTYPE(Nodes[1]), Vec))
825
826 #ifdef UG_DIM_3
827 IdentObjectHdr[nobject++] = PARHDR(theEdge);
828 #endif
829
830 #ifdef UG_DIM_2
831 /* identify to proclist of neighbor */
832 const auto& proclist = DDD_InfoProcListRange(context, PARHDRE(theNeighbor), false);
833 #endif
834
835 /* identify to proclist of father edge or neighbor*/
836 #ifdef UG_DIM_3
837 DDD_HDR hdr;
838 if (0)
839 {
840 EDGE *fatherEdge = NULL;
841
842 /* check whether edge inside the side of the element */
843 fatherEdge = FatherEdge(SideNodes,ncorners,Nodes,theEdge);
844
845 if (fatherEdge != NULL)
846 hdr = PARHDR(fatherEdge);
847 else
848 hdr = PARHDRE(theNeighbor);
849 }
850 hdr = PARHDRE(theNeighbor);
851 const auto& proclist = DDD_InfoProcListRange(context, hdr, false);
852 #endif
853
854 if (CORNERTYPE(Nodes[0]))
855 IdentHdr[nident++] = PARHDR((NODE *)NFATHER(Nodes[0]));
856 #ifdef UG_DIM_3
857 /* since midnodes are identified later in Debug case */
858 /* choose fatheredge here (s.l. 980227) */
859 else if (MIDTYPE(Nodes[0]))
860 IdentHdr[nident++] = PARHDR((EDGE *)NFATHER(Nodes[0]));
861 #endif
862 else
863 IdentHdr[nident++] = PARHDR(Nodes[0]);
864
865 if (CORNERTYPE(Nodes[1]))
866 IdentHdr[nident++] = PARHDR((NODE *)NFATHER(Nodes[1]));
867 #ifdef UG_DIM_3
868 /* since midnodes are identified later in Debug case */
869 /* choose fatheredge here (s.l. 980227) */
870 else if (MIDTYPE(Nodes[1]))
871 IdentHdr[nident++] = PARHDR((EDGE *)NFATHER(Nodes[1]));
872 #endif
873 else
874 IdentHdr[nident++] = PARHDR(Nodes[1]);
875
876 if (nobject > 0)
877 Ident_FctPtr(context, IdentObjectHdr, nobject,
878 proclist, PrioHGhost, IdentHdr, nident);
879
880 /* debugging unlocks the edge */
881 #ifdef Debug
882 if (debug == 1) {
883 SETEDIDENT(theEdge,CLEAR);
884 }
885 else
886 #endif
887 /* lock this edge for identification */
888 SETEDIDENT(theEdge,IDENT);
889
890 return 0;
891 }
892
893
894 /****************************************************************************/
895 /*
896 IdentifyObjectsOfElementSide -
897
898 SYNOPSIS:
899 static INT IdentifyObjectsOfElementSide(GRID *theGrid, ELEMENT *theElement,
900 INT i, ELEMENT *theNeighbor);
901
902 PARAMETERS:
903 . theGrid
904 . theElement
905 . i
906 . theNeighbor
907
908 DESCRIPTION:
909
910 RETURN VALUE:
911 INT
912 */
913 /****************************************************************************/
914
915 static INT IdentifyObjectsOfElementSide(GRID *theGrid, ELEMENT *theElement,
916 INT i, ELEMENT *theNeighbor)
917 {
918 INT nodes;
919 #ifdef Debug
920 INT n = 0;
921 #endif
922 NODE *SideNodes[MAX_SIDE_NODES];
923 INT ncorners;
924 NODE *theNode;
925
926 GetSonSideNodes(theElement,i,&nodes,SideNodes,0);
927 ncorners = CORNERS_OF_SIDE(theElement,i);
928
929 PRINTDEBUG(dddif,1,("%d: IdentifyObjectsOfElementSide():identify NODES "
930 "ncorners=%d nodes=%d\n",me,ncorners,nodes));
931
932 /* identify nodes, vertices and node vectors of son elements */
933 for (INT j = 0; j < MAX_SIDE_NODES; j++)
934 {
935 theNode = SideNodes[j];
936 if (theNode == NULL) continue;
937
938 // identify new node including its vertex
939 IdentifyNode(theGrid,theNeighbor, theNode, SideNodes, j, ncorners);
940 #ifdef Debug
941 n++;
942 #endif
943 }
944 ASSERT(n == nodes);
945
946 /* identify edge vectors (2D); edges, edge and side vectors (3D) */
947 if (/*VEC_DEF_IN_OBJ_OF_GRID(theGrid,EDGEVEC) ||*/ DIM==3)
948 {
949 ELEMENT *SonList[MAX_SONS];
950 INT SonsOfSide,SonSides[MAX_SONS];
951
952 PRINTDEBUG(dddif,1,("%d: IdentifyObjectsOfElementSide(): identify "
953 "EDGES and VECTORS\n",me));
954
955 if (Get_Sons_of_ElementSide(theElement,i,&SonsOfSide,
956 SonList,SonSides,1,0)!=GM_OK)
957 RETURN(GM_FATAL);
958
959 for (INT j = 0; j < SonsOfSide; j++)
960 {
961 if (/*VEC_DEF_IN_OBJ_OF_GRID(theGrid,EDGEVEC) ||*/ DIM==3)
962 {
963 INT edgeofside;
964 INT nedges = EDGES_OF_SIDE(SonList[j],SonSides[j]);
965
966 /* identify the edge and vector */
967 for (edgeofside=0; edgeofside<nedges; edgeofside++) {
968 EDGE *theEdge;
969 INT edge = EDGE_OF_SIDE(SonList[j],SonSides[j],edgeofside);
970
971 theEdge = GetEdge(CORNER_OF_EDGE_PTR(SonList[j],edge,0),
972 CORNER_OF_EDGE_PTR(SonList[j],edge,1));
973 ASSERT(theEdge!=NULL);
974
975 // IdentifySideEdge(theGrid, theEdge, theElement, theNeighbor,
976 // VEC_DEF_IN_OBJ_OF_GRID(theGrid,EDGEVEC));
977 IdentifySideEdge(theGrid, theEdge, theElement, theNeighbor, 0);
978 }
979 }
980
981 #ifdef UG_DIM_3
982 if (VEC_DEF_IN_OBJ_OF_GRID(theGrid,SIDEVEC))
983 {
984 auto& context = theGrid->dddContext();
985 IdentifySideVector(context, theElement,theNeighbor,SonList[j],SonSides[j]);
986 }
987 #endif
988 }
989 }
990
991 return GM_OK;
992 }
993
994
995
996 /****************************************************************************/
997 /*
998 IdentifyDistributedObjects -
999
1000 SYNOPSIS:
1001 INT IdentifyDistributedObjects (MULTIGRID *theMG, INT FromLevel, INT ToLevel);
1002
1003 PARAMETERS:
1004 . theMG
1005 . FromLevel
1006 . ToLevel
1007
1008 DESCRIPTION:
1009
1010 RETURN VALUE:
1011 INT
1012 */
1013 /****************************************************************************/
1014
1015 static INT IdentifyDistributedObjects (MULTIGRID *theMG, INT FromLevel, INT ToLevel)
1016 {
1017 DDD_PRIO prio;
1018
1019 PRINTDEBUG(dddif,1,("%d: IdentifyDistributedObjects(): FromLevel=%d "
1020 "ToLevel=%d\n",me,FromLevel,ToLevel));
1021
1022 /* identify distributed objects */
1023 for (INT l=FromLevel; l<ToLevel; l++)
1024 {
1025 PRINTDEBUG(dddif,1,("%d: IdentifyDistributedObjects(): identification "
1026 "level=%d\n",me,l));
1027
1028 GRID* theGrid = GRID_ON_LEVEL(theMG,l);
1029
1030 #ifdef Debug
1031 identlevel = l;
1032 #endif
1033
1034 /* check control word flags for ident on upper level */
1035 #ifdef Debug
1036 if (debug != 1)
1037 #endif
1038 ResetIdentFlags(GRID_ON_LEVEL(theMG,l+1));
1039
1040 for (ELEMENT* theElement=PFIRSTELEMENT(theGrid); theElement!=NULL;
1041 theElement=SUCCE(theElement))
1042 {
1043 prio = EPRIO(theElement);
1044
1045 if (!IS_REFINED(theElement) || EGHOSTPRIO(prio)) continue;
1046
1047 for (INT i=0; i<SIDES_OF_ELEM(theElement); i++)
1048 {
1049 ELEMENT* theNeighbor = NBELEM(theElement,i);
1050 if (theNeighbor == NULL) continue;
1051
1052 /* TODO: change for full dynamic element distribution */
1053 prio = EPRIO(theNeighbor);
1054 if (!HGHOSTPRIO(prio) || NSONS(theNeighbor)!=0) continue;
1055
1056 PRINTDEBUG(dddif,1,("%d: Identify element: pe=%08x/%x eID=%d "
1057 "side=%d\n",me,DDD_InfoGlobalId(PARHDRE(theElement)),
1058 theElement,ID(theElement),i));
1059
1060 IdentifyObjectsOfElementSide(theGrid,theElement,i,theNeighbor);
1061
1062 }
1063 }
1064 }
1065
1066 return GM_OK;
1067 }
1068
1069
1070 #ifdef IDENT_ONLY_NEW
1071 static int Gather_NewNodeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1072 {
1073 NODE *theNode = (NODE *)obj;
1074 NODE *SonNode = SONNODE(theNode);
1075
1076 /* identification is only done between master objects */
1077 ASSERT(identlevel-1 == LEVEL(theNode));
1078
1079 if (SonNode!=NULL && NEW_NIDENT(SonNode))
1080 {
1081 IFDEBUG(dddif,1)
1082 UserWriteF("new son node=" ID_FMTX "node=" ID_FMTX "\n",
1083 ID_PRTX(SonNode),ID_PRTX(theNode));
1084 ENDDEBUG
1085 *((int *)data) = 1;
1086 }
1087 else
1088 *((int *)data) = 0;
1089
1090 return 0;
1091 }
1092
1093 static int Scatter_NewNodeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1094 {
1095 NODE *theNode = (NODE *)obj;
1096 NODE *SonNode = SONNODE(theNode);
1097 int has_newsonnode = *((int *)data);
1098
1099 /* identification is only done between master objects */
1100 ASSERT(identlevel-1 == LEVEL(theNode));
1101
1102 if (SonNode!=NULL && has_newsonnode) SETNEW_NIDENT(SonNode,1);
1103
1104 return 0;
1105 }
1106
1107 /*************************/
1108
1109 static int Gather_NodeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1110 {
1111 NODE *theNode = (NODE *)obj;
1112
1113 ASSERT(identlevel == LEVEL(theNode));
1114
1115 if (!(NTYPE(theNode)==check_nodetype))
1116 {
1117 *((int *)data) = 0;
1118 return 0;
1119 }
1120
1121 *((int *)data) = NEW_NIDENT(theNode);
1122
1123 return 0;
1124 }
1125
1126 static int Scatter_NodeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1127 {
1128 NODE *theNode = (NODE *)obj;
1129 int nprop = *((int *)data);
1130
1131 ASSERT(identlevel == LEVEL(theNode));
1132
1133 if (!(NTYPE(theNode)==check_nodetype)) return 0;
1134
1135 if (NIDENTASSERT) if (NEW_NIDENT(theNode)) assert(NFATHER(theNode) != NULL);
1136
1137 if (nprop)
1138 {
1139 if (0) SETNEW_NIDENT(theNode,1);
1140 if (NFATHER(theNode) == NULL)
1141 {
1142 UserWriteF("isolated node=" ID_FMTX "\n",
1143 ID_PRTX(theNode));
1144 if (NIDENTASSERT) assert(0);
1145 }
1146 if (NIDENTASSERT) assert(NFATHER(theNode) != NULL);
1147 }
1148
1149 return 0;
1150 }
1151
1152 /*************************/
1153
1154 static int Gather_TestNodeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1155 {
1156 NODE *theNode = (NODE *)obj;
1157
1158 ASSERT(identlevel == LEVEL(theNode));
1159
1160 ((int *)data)[0] = NEW_NIDENT(theNode);
1161 if (NEW_NIDENT(theNode)) assert(NFATHER(theNode) != NULL);
1162
1163 return 0;
1164 }
1165
1166 static int Scatter_TestNodeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1167 {
1168 NODE *theNode = (NODE *)obj;
1169 int nprop = *((int *)data);
1170
1171 ASSERT(identlevel == LEVEL(theNode));
1172
1173 if (NEW_NIDENT(theNode) != nprop)
1174 {
1175 UserWriteF("nprop wrong mynprop=%d hisnprop=%d theNode=" ID_FMTX " LEVEL=%d PROC=%d PRIO=%d\n",
1176 NEW_NIDENT(theNode),nprop,ID_PRTX(theNode),LEVEL(theNode),proc,prio);
1177 fflush(stdout);
1178 assert(0);
1179 }
1180
1181 return 0;
1182 }
1183
1184 /*************************/
1185
1186 static int Gather_IdentSonNode (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1187 {
1188 NODE *theNode = (NODE *)obj;
1189 NODE *SonNode = SONNODE(theNode);
1190
1191 /* identification is only done between master objects */
1192 ASSERT(identlevel-1 == LEVEL(theNode));
1193
1194 ((int *)data)[0] = 0;
1195 ((int *)data)[1] = 0;
1196
1197 if (SonNode != NULL)
1198 {
1199 ((int *)data)[0] = 1;
1200 ((int *)data)[1] = NEW_NIDENT(SonNode);
1201 }
1202
1203 return 0;
1204 }
1205
1206 static int Scatter_IdentSonNode (DDD::DDDContext& context, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1207 {
1208 NODE *theNode = (NODE *)obj;
1209 NODE *SonNode = SONNODE(theNode);
1210 int sonnode = ((int *)data)[0];
1211 int newsonnode = ((int *)data)[1];
1212
1213 /* identification is only done between master objects */
1214 ASSERT(identlevel-1 == LEVEL(theNode));
1215
1216 if (SonNode!=NULL)
1217 {
1218 /*
1219 if (1 || NEW_NIDENT(SonNode))
1220 */
1221 if (NEW_NIDENT(SonNode))
1222 {
1223 if(sonnode)
1224 {
1225 if (!newsonnode)
1226 {
1227 UserWriteF("theNode=" ID_FMTX " LEVEL=%d PROC=%d PRIO=%d sonnprop=%d\n",
1228 ID_PRTX(theNode),LEVEL(theNode),proc,prio,NEW_NIDENT(SonNode));
1229 fflush(stdout);
1230 assert(0);
1231 }
1232
1233 DDD_IdentifyObject(context, PARHDR(SonNode),proc,PARHDR(theNode));
1234 }
1235 }
1236 else
1237 {
1238 if (newsonnode)
1239 {
1240 UserWriteF("theNode=" ID_FMTX " LEVEL=%d PROC=%d PRIO=%d sonnprop=%d\n",
1241 ID_PRTX(theNode),LEVEL(theNode),proc,prio,NEW_NIDENT(SonNode));
1242 fflush(stdout);
1243 assert(0);
1244 }
1245 }
1246 }
1247
1248 return 0;
1249 }
1250
1251 /* callback functions for edge identification */
1252 static int Gather_NewObjectInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1253 {
1254 INT ident_needed;
1255 EDGE *theEdge = (EDGE *)obj;
1256 EDGE *SonEdges[MAX_SON_EDGES];
1257 NODE *MidNode = MIDNODE(theEdge);
1258
1259 /* identification is only done between master objects */
1260 ASSERT(identlevel-1 == LEVEL(theEdge));
1261
1262 *((int *)data) = 0;
1263
1264 GetSonEdges(theEdge,SonEdges);
1265
1266 /* identification is done if one objects of MidNode and the one */
1267 /* or two sonedge have NEW_XXIDENT flags set. */
1268 ident_needed = ((MidNode!=NULL && NEW_NIDENT(MidNode)) ||
1269 (SonEdges[0]!=NULL && NEW_EDIDENT(SonEdges[0])) ||
1270 (SonEdges[1]!=NULL && NEW_EDIDENT(SonEdges[1])));
1271
1272 if (ident_needed)
1273 {
1274 /* send number of objects that need identification */
1275 /* must be equal on all procs */
1276 if (MidNode!=NULL && NEW_NIDENT(MidNode)) ((int *)data)[0] = 1;
1277 if (SonEdges[0]!=NULL && NEW_EDIDENT(SonEdges[0])) ((int *)data)[0] += 2;
1278 if (SonEdges[1]!=NULL && NEW_EDIDENT(SonEdges[1])) ((int *)data)[0] += 4;
1279 }
1280
1281 return 0;
1282 }
1283
1284 static int Scatter_NewObjectInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1285 {
1286 int newsonobjects = *((int *)data);
1287 EDGE *theEdge = (EDGE *)obj;
1288 EDGE *SonEdges[MAX_SON_EDGES];
1289 NODE *MidNode = MIDNODE(theEdge);
1290
1291 /* identification is only done between master objects */
1292 ASSERT(identlevel-1 == LEVEL(theEdge));
1293
1294 GetSonEdges(theEdge,SonEdges);
1295
1296 if (newsonobjects)
1297 {
1298 if (MidNode == NULL)
1299 {
1300 if (SonEdges[0]!=NULL)
1301 if (newsonobjects & 0x2) SETNEW_EDIDENT(SonEdges[0],1);
1302 }
1303 else
1304 {
1305 if (newsonobjects & 0x1)
1306 SETNEW_NIDENT(MidNode,1);
1307 if (SonEdges[0]!=NULL)
1308 if (newsonobjects & 0x2)
1309 SETNEW_EDIDENT(SonEdges[0],1);
1310 if (SonEdges[1]!=NULL)
1311 if (newsonobjects & 0x4)
1312 SETNEW_EDIDENT(SonEdges[1],1);
1313 }
1314 }
1315
1316 return 0;
1317 }
1318
1319 /*************************/
1320
1321 static int Gather_EdgeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1322 {
1323 EDGE *theEdge = (EDGE *)obj;
1324
1325 ASSERT(identlevel == LEVEL(theEdge));
1326
1327 if (GetFatherEdge(theEdge) == NULL)
1328 {
1329 *((int *)data) = 0;
1330 return 0;
1331 }
1332
1333 *((int *)data) = NEW_EDIDENT(theEdge);
1334
1335 return 0;
1336 }
1337
1338 static int Scatter_EdgeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1339 {
1340 EDGE *theEdge = (EDGE *)obj;
1341 int nprop = *((int *)data);
1342 NODE *theNode0 = NBNODE(LINK0(theEdge));
1343 NODE *theNode1 = NBNODE(LINK1(theEdge));
1344
1345 ASSERT(identlevel == LEVEL(theEdge));
1346
1347 if (!CORNERTYPE(theNode0) && !CORNERTYPE(theNode1)) return(0);
1348
1349 if (nprop)
1350 {
1351 if (0) SETNEW_EDIDENT(theEdge,1);
1352 if (GetFatherEdge(theEdge) == NULL)
1353 {
1354 UserWriteF("isolated edge=" ID_FMTX "\n",
1355 ID_PRTX(theEdge));
1356 if (EDIDENTASSERT) assert(0);
1357 }
1358 if (EDIDENTASSERT) assert(GetFatherEdge(theEdge) != NULL);
1359 }
1360
1361 return 0;
1362 }
1363
1364 /*************************/
1365
1366 static int Gather_TestEdgeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1367 {
1368 EDGE *theEdge = (EDGE *)obj;
1369
1370 ASSERT(identlevel == LEVEL(theEdge));
1371
1372 ((int *)data)[0] = NEW_EDIDENT(theEdge);
1373 if (NEW_EDIDENT(theEdge)) assert(GetFatherEdge(theEdge) != NULL);
1374
1375 return 0;
1376 }
1377
1378 static int Scatter_TestEdgeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1379 {
1380 EDGE *theEdge = (EDGE *)obj;
1381 int nprop = *((int *)data);
1382
1383 ASSERT(identlevel == LEVEL(theEdge));
1384
1385 if (NEW_EDIDENT(theEdge) != nprop)
1386 {
1387 UserWriteF("nprop wrong mynprop=%d hisnprop=%d theEdge=" ID_FMTX " LEVEL=%d PROC=%d PRIO=%d\n",
1388 NEW_EDIDENT(theEdge),nprop,ID_PRTX(theEdge),LEVEL(theEdge),proc,prio);
1389 fflush(stdout);
1390 assert(0);
1391 }
1392
1393 return 0;
1394 }
1395
1396 /*************************/
1397
1398 static int Gather_IdentSonEdge (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1399 {
1400 const EDGE *theEdge = (EDGE *)obj;
1401
1402 /* identification is only done between master objects */
1403 ASSERT(identlevel-1 == LEVEL(theEdge));
1404
1405 ((int *)data)[0] = 0;
1406 ((int *)data)[1] = 0;
1407
1408 EDGE *SonEdge = GetSonEdge(theEdge);
1409 if (SonEdge)
1410 {
1411 ((int *)data)[0] = 1;
1412 ((int *)data)[1] = NEW_EDIDENT(SonEdge);
1413 }
1414
1415 return 0;
1416 }
1417
1418 static int Scatter_IdentSonEdge (DDD::DDDContext& context, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1419 {
1420 EDGE *theEdge = (EDGE *)obj;
1421 int sonedge = ((int *)data)[0];
1422 int newsonedge = ((int *)data)[1];
1423
1424 /* identification is only done between master objects */
1425 ASSERT(identlevel-1 == LEVEL(theEdge));
1426
1427 EDGE *SonEdge = GetSonEdge(theEdge);
1428 if (SonEdge)
1429 {
1430 /*
1431 if (1 || NEW_EDIDENT(SonEdge))
1432 */
1433 if (NEW_EDIDENT(SonEdge))
1434 {
1435 if(sonedge)
1436 {
1437 if (!newsonedge)
1438 {
1439 UserWriteF("theEdge=" ID_FMTX " LEVEL=%d PROC=%d PRIO=%d sonnprop=%d\n",
1440 ID_PRTX(theEdge),LEVEL(theEdge),proc,prio,NEW_EDIDENT(SonEdge));
1441 fflush(stdout);
1442 assert(0);
1443 }
1444
1445 DDD_IdentifyObject(context, PARHDR(SonEdge),proc,PARHDR(theEdge));
1446 if (ddd_ctrl(context).edgeData && EDVECTOR(SonEdge)!=NULL)
1447 DDD_IdentifyObject(context, PARHDR(EDVECTOR(SonEdge)),proc,PARHDR(theEdge));
1448 }
1449 }
1450 else
1451 {
1452 if (newsonedge)
1453 {
1454 UserWriteF("theEdge=" ID_FMTX " LEVEL=%d PROC=%d PRIO=%d sonnprop=%d\n",
1455 ID_PRTX(theEdge),LEVEL(theEdge),proc,prio,NEW_EDIDENT(SonEdge));
1456 fflush(stdout);
1457 assert(0);
1458 }
1459 }
1460 }
1461
1462 return 0;
1463 }
1464
1465 /*************************/
1466
1467 static int Gather_IdentSonObjects (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1468 {
1469 INT ident_needed;
1470 EDGE *theEdge = (EDGE *)obj;
1471 EDGE *SonEdges[2];
1472 NODE *MidNode = MIDNODE(theEdge);
1473
1474 /* identification is only done between master objects */
1475 ASSERT(identlevel-1 == LEVEL(theEdge));
1476
1477 ((int *)data)[0] = 0;
1478
1479 GetSonEdges(theEdge, SonEdges);
1480
1481 /* identification is done if one objects of MidNode and the one */
1482 /* or two sonedge have NEW_XXIDENT flags set. */
1483 ident_needed = ((MidNode!=NULL && NEW_NIDENT(MidNode)) ||
1484 (SonEdges[0]!=NULL && NEW_EDIDENT(SonEdges[0])) ||
1485 (SonEdges[1]!=NULL && NEW_EDIDENT(SonEdges[1])));
1486
1487 if (ident_needed)
1488 {
1489 /* send number of objects that need identification */
1490 /* must be equal on all procs */
1491 if (MidNode!=NULL && NEW_NIDENT(MidNode)) ((int *)data)[0] = 1;
1492 if (SonEdges[0]!=NULL && NEW_EDIDENT(SonEdges[0])) ((int *)data)[0] += 2;
1493 if (SonEdges[1]!=NULL && NEW_EDIDENT(SonEdges[1])) ((int *)data)[0] += 4;
1494 }
1495
1496 return 0;
1497 }
1498
1499 static int Scatter_IdentSonObjects (DDD::DDDContext& context, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1500 {
1501 int newsonobjects = *((int *)data);
1502 EDGE *theEdge = (EDGE *)obj;
1503 EDGE *SonEdges[2];
1504 NODE *MidNode = MIDNODE(theEdge);
1505 NODE *SonNode0,*SonNode1;
1506
1507 /* identification is only done between master objects */
1508 ASSERT(identlevel-1 == LEVEL(theEdge));
1509
1510 [[maybe_unused]] INT nedges = GetSonEdges(theEdge,SonEdges);
1511
1512 if (newsonobjects)
1513 {
1514 if (0)
1515 ASSERT((MidNode==NULL && nedges!=2) ||
1516 (MidNode!=NULL && nedges==2));
1517
1518 if (MidNode==NULL)
1519 {
1520 if (SonEdges[0]!=NULL && NEW_EDIDENT(SonEdges[0]))
1521 {
1522 ASSERT(newsonobjects & 0x2);
1523
1524 DDD_IdentifyObject(context, PARHDR(SonEdges[0]),proc,PARHDR(theEdge));
1525 if (ddd_ctrl(context).edgeData && EDVECTOR(SonEdges[0])!=NULL)
1526 DDD_IdentifyObject(context, PARHDR(EDVECTOR(SonEdges[0])),proc,PARHDR(theEdge));
1527 }
1528 }
1529 else
1530 {
1531
1532 /* identify midnode */
1533 if (MidNode!=NULL && NEW_NIDENT(MidNode))
1534 {
1535 ASSERT(newsonobjects & 0x1);
1536 if (0) {
1537 ASSERT(MidNode!=NULL && SonEdges[0]!=NULL && SonEdges[1]!=NULL);
1538 ASSERT(nedges==2);
1539 }
1540
1541 if (1)
1542 {
1543 DDD_IdentifyObject(context, PARHDR(MidNode),proc,PARHDR(theEdge));
1544 DDD_IdentifyObject(context, PARHDRV(MYVERTEX(MidNode)),proc,PARHDR(theEdge));
1545 }
1546 else
1547 {
1548 NODE *Node0 = NBNODE(LINK0(theEdge));
1549 NODE *Node1 = NBNODE(LINK1(theEdge));
1550 DDD_IdentifyObject(context, PARHDR(MidNode),proc,PARHDR(Node0));
1551 DDD_IdentifyObject(context, PARHDR(MidNode),proc,PARHDR(Node1));
1552 DDD_IdentifyObject(context, PARHDRV(MYVERTEX(MidNode)),proc,PARHDR(Node0));
1553 DDD_IdentifyObject(context, PARHDRV(MYVERTEX(MidNode)),proc,PARHDR(Node1));
1554 }
1555 }
1556
1557 if (SonEdges[0]!=NULL && NEW_EDIDENT(SonEdges[0]) && (newsonobjects & 0x2))
1558 {
1559 if (0) {
1560 ASSERT(MidNode!=NULL && SonEdges[0]!=NULL && SonEdges[1]!=NULL);
1561 ASSERT(nedges==2);
1562 }
1563 /* identify edge0 */
1564 SonNode0 = NBNODE(LINK0(SonEdges[0]));
1565 SonNode1 = NBNODE(LINK1(SonEdges[0]));
1566 NODE *IdentNode;
1567 if (CORNERTYPE(SonNode0))
1568 {
1569 ASSERT(NFATHER(SonNode0)!=NULL);
1570 IdentNode = SonNode0;
1571 }
1572 else
1573 {
1574 ASSERT(CORNERTYPE(SonNode1));
1575 ASSERT(NFATHER(SonNode1)!=NULL);
1576 IdentNode = SonNode1;
1577 }
1578 DDD_IdentifyObject(context, PARHDR(SonEdges[0]),proc,PARHDR(theEdge));
1579 DDD_IdentifyObject(context, PARHDR(SonEdges[0]),proc,PARHDR((NODE *)NFATHER(IdentNode)));
1580 if (ddd_ctrl(context).edgeData && EDVECTOR(SonEdges[0])!=NULL)
1581 {
1582 DDD_IdentifyObject(context, PARHDR(EDVECTOR(SonEdges[0])),proc,PARHDR(theEdge));
1583 DDD_IdentifyObject(context, PARHDR(EDVECTOR(SonEdges[0])),proc,PARHDR((NODE *)NFATHER(IdentNode)));
1584 }
1585 }
1586
1587 if (SonEdges[1]!=NULL && NEW_EDIDENT(SonEdges[1]) && (newsonobjects & 0x4))
1588 {
1589 if (0) {
1590 ASSERT(MidNode!=NULL && SonEdges[0]!=NULL && SonEdges[1]!=NULL);
1591 ASSERT(nedges==2);
1592 }
1593 /* identify edge1 */
1594 SonNode0 = NBNODE(LINK0(SonEdges[1]));
1595 SonNode1 = NBNODE(LINK1(SonEdges[1]));
1596 NODE *IdentNode;
1597 if (CORNERTYPE(SonNode0))
1598 {
1599 ASSERT(NFATHER(SonNode0)!=NULL);
1600 IdentNode = SonNode0;
1601 }
1602 else
1603 {
1604 ASSERT(CORNERTYPE(SonNode1));
1605 ASSERT(NFATHER(SonNode1)!=NULL);
1606 IdentNode = SonNode1;
1607 }
1608 DDD_IdentifyObject(context, PARHDR(SonEdges[1]),proc,PARHDR(theEdge));
1609 DDD_IdentifyObject(context, PARHDR(SonEdges[1]),proc,PARHDR((NODE *)NFATHER(IdentNode)));
1610 if (ddd_ctrl(context).edgeData && EDVECTOR(SonEdges[1])!=NULL)
1611 {
1612 DDD_IdentifyObject(context, PARHDR(EDVECTOR(SonEdges[1])),proc,PARHDR(theEdge));
1613 DDD_IdentifyObject(context, PARHDR(EDVECTOR(SonEdges[1])),proc,PARHDR((NODE *)NFATHER(IdentNode)));
1614 }
1615 }
1616 }
1617 }
1618
1619 return 0;
1620 }
1621
1622 #endif
1623
1624
1625
1626 #ifndef IDENT_ONLY_NEW
1627
1628 /****************************************************************************/
1629 /*
1630 Gather_SonNodeInfo -
1631
1632 SYNOPSIS:
1633 static int Gather_SonNodeInfo (DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio);
1634
1635 PARAMETERS:
1636 . obj
1637 . data
1638 . proc
1639 . prio
1640
1641 DESCRIPTION:
1642
1643 RETURN VALUE:
1644 int
1645 */
1646 /****************************************************************************/
1647
1648 static int Gather_SonNodeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1649 {
1650 NODE *theNode = (NODE *)obj;
1651
1652 /* identification is only done between master objects */
1653 ASSERT(identlevel-1 == LEVEL(theNode));
1654
1655 if (SONNODE(theNode) != NULL)
1656 *((int *)data) = 1;
1657 else
1658 *((int *)data) = 0;
1659
1660 return 0;
1661 }
1662
1663 /****************************************************************************/
1664 /*
1665 Scatter_SonNodeInfo -
1666
1667 SYNOPSIS:
1668 static int Scatter_SonNodeInfo (DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio);
1669
1670 PARAMETERS:
1671 . obj
1672 . data
1673 . proc
1674 . prio
1675
1676 DESCRIPTION:
1677
1678 RETURN VALUE:
1679 int
1680 */
1681 /****************************************************************************/
1682
1683 static int Scatter_SonNodeInfo (DDD::DDDContext& context, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1684 {
1685 NODE *theNode = (NODE *)obj;
1686 NODE *SonNode = SONNODE(theNode);
1687 INT has_sonnode = *((int *)data);
1688
1689 /* identification is only done between master objects */
1690 ASSERT(identlevel-1 == LEVEL(theNode));
1691
1692 if (SonNode != NULL)
1693 {
1694 if (has_sonnode)
1695 {
1696 DDD_IdentifyObject(context, PARHDR(SonNode),proc,PARHDR(theNode));
1697 if (ddd_ctrl(context).nodeData && NVECTOR(SonNode)!=NULL)
1698 DDD_IdentifyObject(context, PARHDR(NVECTOR(SonNode)),proc,PARHDR(theNode));
1699 IFDEBUG(dddif,1)
1700 if (ddd_ctrl(context).nodeData && NVECTOR(SonNode)!=NULL)
1701 PrintDebug ("l=%d IdentHdr: %d Proc: %d me:%d IdentObjectHdr: %d %d\n",
1702 identlevel,GID(theNode),proc,me,GID(SonNode),GID(EDVECTOR(SonNode)));
1703 else
1704 PrintDebug ("l=%d IdentHdr: %d Proc: %d me:%d IdentObjectHdr: %d\n",
1705 identlevel,GID(theNode),proc,me,GID(SonNode));
1706 ENDDEBUG
1707 }
1708 }
1709
1710 return 0;
1711 }
1712
1713
1714 #ifdef UG_DIM_3
1715
1716 /****************************************************************************/
1717 /*
1718 Gather_SonEdgeInfo -
1719
1720 SYNOPSIS:
1721 static int Gather_SonEdgeInfo (DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio);
1722
1723 PARAMETERS:
1724 . obj
1725 . data
1726 . proc
1727 . prio
1728
1729 DESCRIPTION:
1730
1731 RETURN VALUE:
1732 int
1733 */
1734 /****************************************************************************/
1735
1736 static int Gather_SonEdgeInfo (DDD::DDDContext&, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1737 {
1738 EDGE *theEdge = (EDGE *)obj;
1739
1740 /* identification has to be done between all copies of an objects */
1741 /* otherwise this can result in unsymmetric interfaces */
1742 ASSERT(identlevel-1 == LEVEL(theEdge));
1743
1744 EDGE *SonEdge = GetSonEdge(theEdge);
1745 if (SonEdge)
1746 *((int *)data) = 1;
1747 else
1748 *((int *)data) = 0;
1749
1750 return 0;
1751 }
1752
1753
1754 /****************************************************************************/
1755 /*
1756 Scatter_SonEdgeInfo -
1757
1758 SYNOPSIS:
1759 static int Scatter_SonEdgeInfo (DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio);
1760
1761 PARAMETERS:
1762 . obj
1763 . data
1764 . proc
1765 . prio
1766
1767 DESCRIPTION:
1768
1769 RETURN VALUE:
1770 int
1771 */
1772 /****************************************************************************/
1773
1774 static int Scatter_SonEdgeInfo (DDD::DDDContext& context, DDD_OBJ obj, void *data, DDD_PROC proc, DDD_PRIO prio)
1775 {
1776 EDGE *theEdge = (EDGE *)obj;
1777 INT has_sonedge = *((int *)data);
1778
1779 /* identification has to be done between all copies of an objects */
1780 /* otherwise this can result in unsymmetric interfaces */
1781 ASSERT(identlevel-1 == LEVEL(theEdge));
1782
1783 EDGE *SonEdge = GetSonEdge(theEdge);
1784 if (SonEdge)
1785 {
1786 if (has_sonedge)
1787 {
1788 DDD_IdentifyObject(context, PARHDR(SonEdge),proc,PARHDR(theEdge));
1789 if (ddd_ctrl(context).edgeData && EDVECTOR(SonEdge)!=NULL)
1790 DDD_IdentifyObject(context, PARHDR(EDVECTOR(SonEdge)),proc,PARHDR(theEdge));
1791 IFDEBUG(dddif,1)
1792 if (ddd_ctrl(context).edgeData && EDVECTOR(SonEdge)!=NULL)
1793 PrintDebug ("l=%d IdentHdr: %d Proc: %d me:%d IdentObjectHdr: %d %d\n",
1794 identlevel,GID(theEdge),proc,me,GID(SonEdge),GID(EDVECTOR(SonEdge)));
1795 else
1796 PrintDebug ("l=%d IdentHdr: %d Proc: %d me:%d IdentObjectHdr: %d\n",
1797 identlevel,GID(theEdge),proc,me,GID(SonEdge));
1798 ENDDEBUG
1799 }
1800 }
1801
1802 return 0;
1803 }
1804 #endif
1805 #endif
1806
1807 /****************************************************************************/
1808 /*
1809 Identify_SonNodes - identify son nodes (type CORNERNODE)
1810
1811 SYNOPSIS:
1812 INT Identify_SonNodes (GRID *theGrid);
1813
1814 PARAMETERS:
1815 . theGrid
1816
1817 DESCRIPTION:
1818
1819 RETURN VALUE:
1820 INT
1821 */
1822 /****************************************************************************/
1823
1824 static INT Identify_SonNodes (GRID *theGrid)
1825 {
1826 auto& context = theGrid->dddContext();
1827 const auto& dddctrl = ddd_ctrl(context);
1828
1829 #ifdef IDENT_ONLY_NEW
1830 DDD_IFAOnewayX(context,
1831 dddctrl.NodeAllIF,GRID_ATTR(theGrid),IF_FORWARD,sizeof(int),
1832 Gather_NewNodeInfo,Scatter_NewNodeInfo);
1833
1834 if (UPGRID(theGrid) != NULL)
1835 {
1836 check_nodetype = CORNER_NODE;
1837 if (NIDENTASSERT)
1838 DDD_IFAOnewayX(context,
1839 dddctrl.NodeAllIF,GRID_ATTR(UPGRID(theGrid)),IF_FORWARD,sizeof(int),
1840 Gather_NodeInfo,Scatter_NodeInfo);
1841 if (0)
1842 DDD_IFAOnewayX(context,
1843 dddctrl.NodeAllIF,GRID_ATTR(UPGRID(theGrid)),IF_FORWARD,sizeof(int),
1844 Gather_TestNodeInfo,Scatter_TestNodeInfo);
1845 }
1846
1847 DDD_IFAOnewayX(context,
1848 dddctrl.NodeAllIF,GRID_ATTR(theGrid),IF_FORWARD,2*sizeof(int),
1849 Gather_IdentSonNode,Scatter_IdentSonNode);
1850
1851 #else
1852
1853 DDD_IFAOnewayX(context,
1854 dddctrl.NodeAllIF,GRID_ATTR(theGrid),IF_FORWARD,sizeof(int),
1855 Gather_SonNodeInfo,Scatter_SonNodeInfo);
1856
1857 #endif
1858 return GM_OK;
1859 }
1860
1861
1862 /****************************************************************************/
1863 /*
1864 Identify_SonEdges - identify son edges
1865
1866 SYNOPSIS:
1867 INT Identify_SonEdges (GRID *theGrid);
1868
1869 PARAMETERS:
1870 . theGrid
1871
1872 DESCRIPTION:
1873
1874 RETURN VALUE:
1875 INT
1876 */
1877 /****************************************************************************/
1878
1879 INT Identify_SonEdges (GRID *theGrid)
1880 {
1881 auto& context = theGrid->dddContext();
1882 const auto& dddctrl = ddd_ctrl(context);
1883
1884 #ifdef IDENT_ONLY_NEW
1885
1886 DDD_IFAOnewayX(context,
1887 dddctrl.EdgeSymmVHIF,GRID_ATTR(theGrid),IF_FORWARD,sizeof(int),
1888 Gather_NewObjectInfo,Scatter_NewObjectInfo);
1889
1890 if (UPGRID(theGrid) != NULL)
1891 {
1892 check_nodetype = MID_NODE;
1893 DDD_IFAOnewayX(context,
1894 dddctrl.NodeAllIF,GRID_ATTR(UPGRID(theGrid)),IF_FORWARD,sizeof(int),
1895 Gather_NodeInfo,Scatter_NodeInfo);
1896 if (EDIDENTASSERT)
1897 DDD_IFAOnewayX(context,
1898 dddctrl.EdgeSymmVHIF,GRID_ATTR(UPGRID(theGrid)),IF_FORWARD,sizeof(int),
1899 Gather_EdgeInfo,Scatter_EdgeInfo);
1900 if (0)
1901 DDD_IFAOnewayX(context,
1902 dddctrl.EdgeSymmVHIF,GRID_ATTR(UPGRID(theGrid)),IF_FORWARD,sizeof(int),
1903 Gather_TestEdgeInfo,Scatter_TestEdgeInfo);
1904 }
1905
1906 DDD_IFAOnewayX(context,
1907 dddctrl.EdgeSymmVHIF,GRID_ATTR(theGrid),IF_FORWARD,sizeof(int),
1908 Gather_IdentSonObjects,Scatter_IdentSonObjects);
1909
1910 #else
1911
1912 /* identify the sonedges */
1913 DDD_IFAOnewayX(context,
1914 dddctrl.EdgeSymmVHIF,GRID_ATTR(theGrid),IF_FORWARD,sizeof(int),
1915 Gather_SonEdgeInfo,Scatter_SonEdgeInfo);
1916
1917 #endif
1918
1919 return GM_OK;
1920 }
1921
1922
1923 /****************************************************************************/
1924 /*
1925 Identify_SonObjects - identify son objects
1926
1927 SYNOPSIS:
1928 INT Identify_SonObjects (GRID *theGrid);
1929
1930 PARAMETERS:
1931 . theGrid
1932
1933 DESCRIPTION:
1934 This function identifies all objects which are not symmetrically created
1935 during grid adaption. These are edges and nodes of the type used by
1936 yellow elements, son nodes of type CORNERNODE and son edges.
1937
1938 RETURN VALUE:
1939 INT
1940 */
1941 /****************************************************************************/
1942
1943 #define NODESFIRST 1
1944
1945 INT NS_DIM_PREFIX Identify_SonObjects (GRID *theGrid)
1946 {
1947 #ifdef Debug
1948 identlevel = GLEVEL(theGrid)+1;
1949 #endif
1950
1951 if (NODESFIRST)
1952 {
1953 if (Identify_SonNodes (theGrid) != GM_OK) RETURN(GM_ERROR);
1954 }
1955 else
1956 {
1957 if (Identify_SonEdges (theGrid) != GM_OK) RETURN(GM_ERROR);
1958 }
1959
1960 if (IDENT_IN_STEPS)
1961 {
1962 DDD_IdentifyEnd(theGrid->dddContext());
1963 DDD_IdentifyBegin(theGrid->dddContext());
1964 }
1965
1966
1967 if (!NODESFIRST)
1968 {
1969 if (Identify_SonNodes (theGrid) != GM_OK) RETURN(GM_ERROR);
1970 }
1971 else
1972 {
1973 if (Identify_SonEdges (theGrid) != GM_OK) RETURN(GM_ERROR);
1974 }
1975
1976 return GM_OK;
1977 }
1978
1979 /****************************************************************************/
1980 /*
1981 Identify_Objects_of_ElementSide -
1982
1983 SYNOPSIS:
1984 INT Identify_Objects_of_ElementSide(GRID *theGrid, ELEMENT *theElement, INT i);
1985
1986 PARAMETERS:
1987 . theGrid
1988 . theElement
1989 . i
1990
1991 DESCRIPTION:
1992
1993 RETURN VALUE:
1994 INT
1995 */
1996 /****************************************************************************/
1997
1998 INT NS_DIM_PREFIX Identify_Objects_of_ElementSide(GRID *theGrid, ELEMENT *theElement, INT i)
1999 {
2000 ELEMENT* theNeighbor = NBELEM(theElement,i);
2001 if (theNeighbor == NULL) return GM_OK;
2002
2003 const DDD_PRIO prio = EPRIO(theNeighbor);
2004 /* identification is only needed if theNeighbor removed his refinement */
2005 /* or was not refined before, thus has NSONS==0, if NSONS>0 the objects */
2006 /* shared between the element sides are already identified and no new */
2007 /* objects are created for this element side which need identification */
2008 /* (980217 s.l.) */
2009 /*
2010 if (!EHGHOSTPRIO(prio) || NSONS(theNeighbor)!=0) return(GM_OK);
2011 */
2012 if (!EHGHOSTPRIO(prio) || !MARKED(theNeighbor)) return(GM_OK);
2013
2014 #ifdef Debug
2015 identlevel = GLEVEL(theGrid);
2016 #endif
2017 if (IdentifyObjectsOfElementSide(theGrid,theElement,i,theNeighbor)) RETURN(GM_FATAL);
2018
2019 return GM_OK;
2020 }
2021
2022
2023 /****************************************************************************/
2024 /*
2025 IdentifyInit-
2026
2027 SYNOPSIS:
2028 void IdentifyInit (MULTIGRID *theMG);
2029
2030 PARAMETERS:
2031 . theMG
2032
2033 DESCRIPTION:
2034
2035 RETURN VALUE:
2036 void
2037 */
2038 /****************************************************************************/
2039
2040 void NS_DIM_PREFIX IdentifyInit (MULTIGRID *theMG)
2041 {
2042 #ifdef Debug
2043 debug = 0;
2044 #endif
2045
2046 /* allocate a control word entry to lock nodes */
2047 if (AllocateControlEntry(NODE_CW,NEW_NIDENT_LEN,&ce_NEW_NIDENT) != GM_OK)
2048 assert(0);
2049
2050 /* allocate a control word entry to lock edges */
2051 if (AllocateControlEntry(EDGE_CW,NEW_EDIDENT_LEN,&ce_NEW_EDIDENT) != GM_OK)
2052 assert(0);
2053
2054 for (INT i=0; i<=TOPLEVEL(theMG); i++)
2055 ResetIdentFlags(GRID_ON_LEVEL(theMG,i));
2056
2057 /* set Ident_FctPtr to identification mode */
2058 Ident_FctPtr = Identify_by_ObjectList;
2059
2060 }
2061
2062
2063 /****************************************************************************/
2064 /*
2065 IdentifyExit -
2066
2067 SYNOPSIS:
2068 void IdentifyExit (void);
2069
2070 PARAMETERS:
2071 . void
2072
2073 DESCRIPTION:
2074
2075 RETURN VALUE:
2076 void
2077 */
2078 /****************************************************************************/
2079
2080 void NS_DIM_PREFIX IdentifyExit (void)
2081 {
2082 FreeControlEntry(ce_NEW_NIDENT);
2083 FreeControlEntry(ce_NEW_EDIDENT);
2084 }
2085
2086 #endif /* end ModelP */