From 523a7b49b70da796ea3f59957d592bf30dbbf601 Mon Sep 17 00:00:00 2001
From: Henrik Stolzmann <henrik.stolzmann@mailbox.tu-dresden.de>
Date: Thu, 17 Oct 2019 23:23:36 +0200
Subject: [PATCH] Removed data member vector::skip

See Issue `#29`.
Removed `vector::skip` and the  code that uses it. It compiles and the
few existing tests run without problems.
---
 gm/algebra.cc             | 64 +++++++++++----------------------------
 gm/gm.doc                 | 19 ------------
 gm/gm.h                   | 16 ----------
 gm/ugm.cc                 |  7 -----
 np/np.h                   |  6 ----
 np/udm/disctools.cc       |  2 --
 parallel/dddif/initddd.cc |  1 -
 7 files changed, 18 insertions(+), 97 deletions(-)

diff --git a/gm/algebra.cc b/gm/algebra.cc
index b1070b9a6..0399aad6d 100644
--- a/gm/algebra.cc
+++ b/gm/algebra.cc
@@ -354,7 +354,6 @@ static INT CreateVectorInPart (GRID *theGrid, INT DomPart, INT VectorObjType,
   VOBJECT(pv) = object;
   VINDEX(pv) = (long)NVEC(theGrid);
   SUCCVC(pv) = FIRSTVECTOR(theGrid);
-  VECSKIP(pv) = 0;
   VSTART(pv) = NULL;
 
   GRID_LINK_VECTOR(theGrid,pv,PrioMaster);
@@ -3888,7 +3887,7 @@ static INT LexAlgDep (GRID *theGrid, const char *data)
   DOUBLE_VECTOR pos,nbpos;
   DOUBLE diff[DIM];
   INT i,order,res;
-  INT Sign[DIM],Order[DIM],xused,yused,zused,error,SpecialTreatSkipVecs;
+  INT Sign[DIM],Order[DIM],xused,yused,zused,error;
   char ord[3];
 
   /* read ordering directions */
@@ -3959,13 +3958,6 @@ static INT LexAlgDep (GRID *theGrid, const char *data)
     return(1);
   }
 
-  /* treat vectors with skipflag set specially? */
-  SpecialTreatSkipVecs = false;
-  if              (strchr(data,'<')!=NULL)
-    SpecialTreatSkipVecs = GM_PUT_AT_BEGIN;
-  else if (strchr(data,'>')!=NULL)
-    SpecialTreatSkipVecs = GM_PUT_AT_END;
-
   theMG   = MYMG(theGrid);
 
   /* find an approximate measure for the mesh size */
@@ -3985,50 +3977,30 @@ static INT LexAlgDep (GRID *theGrid, const char *data)
       SETMUP(theMatrix,0);
       SETMDOWN(theMatrix,0);
 
-      if (SpecialTreatSkipVecs)
-      {
-        if (VECSKIP(theVector) && !VECSKIP(NBVector))
-        {
-          if (SpecialTreatSkipVecs==GM_PUT_AT_BEGIN)
-            order = -1;
-          else
-            order =  1;
-        }
+      VectorPosition(NBVector,nbpos);
 
-        if (VECSKIP(NBVector) && !VECSKIP(theVector))
+      V_DIM_SUBTRACT(nbpos,pos,diff);
+      V_DIM_SCALE(InvMeshSize,diff);
+
+      if (fabs(diff[Order[DIM-1]])<ORDERRES)
+      {
+                                      #ifdef __THREEDIM__
+        if (fabs(diff[Order[DIM-2]])<ORDERRES)
         {
-          if (SpecialTreatSkipVecs==GM_PUT_AT_BEGIN)
-            order =  1;
-          else
-            order = -1;
+          if (diff[Order[DIM-3]]>0.0) order = -Sign[DIM-3];
+          else order =  Sign[DIM-3];
         }
+        else
+                                      #endif
+        if (diff[Order[DIM-2]]>0.0) order = -Sign[DIM-2];
+        else order =  Sign[DIM-2];
       }
       else
       {
-        VectorPosition(NBVector,nbpos);
-
-        V_DIM_SUBTRACT(nbpos,pos,diff);
-        V_DIM_SCALE(InvMeshSize,diff);
-
-        if (fabs(diff[Order[DIM-1]])<ORDERRES)
-        {
-                                        #ifdef __THREEDIM__
-          if (fabs(diff[Order[DIM-2]])<ORDERRES)
-          {
-            if (diff[Order[DIM-3]]>0.0) order = -Sign[DIM-3];
-            else order =  Sign[DIM-3];
-          }
-          else
-                                        #endif
-          if (diff[Order[DIM-2]]>0.0) order = -Sign[DIM-2];
-          else order =  Sign[DIM-2];
-        }
-        else
-        {
-          if (diff[Order[DIM-1]]>0.0) order = -Sign[DIM-1];
-          else order =  Sign[DIM-1];
-        }
+        if (diff[Order[DIM-1]]>0.0) order = -Sign[DIM-1];
+        else order =  Sign[DIM-1];
       }
+      
       if (order==1) SETMUP(theMatrix,1);
       else SETMDOWN(theMatrix,1);
     }
diff --git a/gm/gm.doc b/gm/gm.doc
index bcf5b0cda..940302693 100644
--- a/gm/gm.doc
+++ b/gm/gm.doc
@@ -1530,9 +1530,6 @@ all degrees of freedom stored in the vector.
 
 . index - Reflects position of the VECTOR in the double linked list.
 
-. skip - Used bitwise to identify components of a VECTOR that have Dirichlet boundary 
-conditions. These components have to be treated differently in some parts of the solver.
-
 . start - Points to first element of the MATRIX list of a VECTOR. This
 list represents the rows of the matrix belonging to degrees of freedom in
 the given VECTOR.
@@ -1562,22 +1559,6 @@ INT VINDEX (VECTOR *v);
 Position of the VECTOR in the doubl linked list. This is useful for
 the implementation of some iterative schemes.
 
-\verbatim
-INT VSKIPME (VECTOR *v,INT n);
-INT VVECSKIP (VECTOR *v,INT n);
-INT VFULLSKIP (VECTOR *v,INT n);
-void SETVSKIPME (VECTOR *v,INT n);
-INT VECSKIP (VECTOR *v);
-INT VECSKIPBIT (VECTOR *v,INT n);
-void SETVECSKIPBIT (VECTOR *v,INT n);
-\endverbatim
-
-????
-Macros to modify the skip flags. VECSKIP returns value of the skip word. Since it is
-a macro it can also be used for assigning a value to the skip word, e.g.
-VECSKIP(v)=0 will reset all bits in the skip word. VECSKIPBIT returns true
-if the n th bit of the skip word is set. SETVECSKIPBIT sets the nth
-bit of the skip word to 1.
 
 \verbatim
 MATRIX *VSTART (VECTOR *v);
diff --git a/gm/gm.h b/gm/gm.h
index 33872bf92..51f544a7f 100644
--- a/gm/gm.h
+++ b/gm/gm.h
@@ -507,9 +507,6 @@ struct vector {
   INT id;
 #endif
 
-  /** \brief used bitwise to skip unknowns                */
-  UINT skip;
-
   /** \brief implements matrix                                    */
   struct matrix *start;
 
@@ -1899,7 +1896,6 @@ enum GM_CE {
 
 enum LV_MODIFIERS {
 
-  LV_SKIP                 = (1<<0),                     /* print skip flags in vector                   */
   LV_VO_INFO              = (1<<1),                     /* vector object related info                   */
   LV_POS                  = (1<<2)                      /* position vector  */
 };
@@ -2106,13 +2102,6 @@ enum LV_ID_TYPES {
 #define SUCCVC(v)                                       ((v)->succ)
 #define VINDEX(v)                                       ((v)->index)
 #define V_IN_DATATYPE(v,dt)                     (VDATATYPE(v) & (dt))
-#define VSKIPME(v,n)                            ((((v)->skip)>>n) & 1)
-#define VVECSKIP(v,n)                           ((((v)->skip)>>n) & 15)
-#define VFULLSKIP(v,n)                          (VVECSKIP(v,n)==15)
-#define SETVSKIPME(v,n)                         (((v)->skip=n))
-#define VECSKIP(v)                                      ((v)->skip)
-#define VECSKIPBIT(v,n)                         (((v)->skip) & (1<<n))
-#define SETVECSKIPBIT(v,n)                      (v)->skip = ((v)->skip & (~(1<<n))) | (1<<n)
 #define VSTART(v)                                       ((v)->start)
 #define VVALUE(v,n)                             ((v)->value[n])
 #define VVALUEPTR(v,n)                          (&((v)->value[n]))
@@ -3139,11 +3128,6 @@ enum {GM_ALL_LEVELS = 1,
 
 enum {GM_ORDER_IN_COLS, GM_ORDER_IN_ROWS};
 
-enum {GM_PUT_AT_BEGIN = 1,               /*!< put skip vectors at begin of the list */
-      GM_PUT_AT_END = 2                  /*!< put skip vectors at end of the list */
-};
-#define GM_TAKE_SKIP                            (1<<0)
-#define GM_TAKE_NONSKIP                         (1<<1)
 /*@}*/
 
 /* get/set current multigrid, loop through multigrids */
diff --git a/gm/ugm.cc b/gm/ugm.cc
index d3a10c3e2..3065c59ea 100644
--- a/gm/ugm.cc
+++ b/gm/ugm.cc
@@ -6495,13 +6495,6 @@ void NS_DIM_PREFIX ListVector (const MULTIGRID *theMG, const VECTOR *theVector,
   /* print vector data if */
   if (dataopt && FMT_PR_VEC(theFormat)!=NULL)
   {
-    /* print skip flags */
-    if (READ_FLAG(modifiers,LV_SKIP))
-    {
-      INT_2_bitpattern(VECSKIP(theVector),buffer);
-      UserWriteF("  skip=%s\n",buffer);
-    }
-
     /* print data */
     Data = (void*)(&VVALUE(theVector,0));
     if ((*(FMT_PR_VEC(theFormat)))(VTYPE(theVector),Data,"   ",buffer))
diff --git a/np/np.h b/np/np.h
index 008b4f208..062c6d327 100644
--- a/np/np.h
+++ b/np/np.h
@@ -107,12 +107,6 @@ START_UGDIM_NAMESPACE
 #define DISPLAY_NP_FORMAT_SIII                  "%-16.13s = %-2d  %-2d  %-2d\n"
 #define DISPLAY_NP_FORMAT_FF                    "%-7.4g  %-7.4g\n"
 
-#define CLEAR_VECSKIP_OF_GRID(g)                                \
-  { VECTOR *theVector;                                 \
-    for (theVector=FIRSTVECTOR((g)); theVector!= NULL; \
-         theVector=SUCCVC(theVector))                  \
-      VECSKIP(theVector) = 0;}
-
 /****************************************************************************/
 /*                                                                          */
 /* function declarations                                                                                                        */
diff --git a/np/udm/disctools.cc b/np/udm/disctools.cc
index a177fdbfe..ff93a6de6 100644
--- a/np/udm/disctools.cc
+++ b/np/udm/disctools.cc
@@ -108,8 +108,6 @@ static void PrintSingleVectorX (const VECTOR *v, const VECDATA_DESC *X, INT vcla
     i += sprintf(buffer+i,"u[%d]=%15.8f ",j,VVALUE(v,comp));
   }
   i += sprintf(buffer+i,"   cl %d %d sk ",VCLASS(v),VNCLASS(v));
-  for (j=0; j<ncomp; j++)
-    i += sprintf(buffer+i,"%d ",((VECSKIP(v) & (1<<j))!=0));
   i += sprintf(buffer+i,"n %d t %d o %d\n",VNEW(v),VTYPE(v),VOTYPE(v));
   Printf(buffer);
 
diff --git a/parallel/dddif/initddd.cc b/parallel/dddif/initddd.cc
index 6c2e7627f..73d7f5477 100644
--- a/parallel/dddif/initddd.cc
+++ b/parallel/dddif/initddd.cc
@@ -406,7 +406,6 @@ static void ddd_DefineTypes(DDD::DDDContext& context)
                  EL_LDATA,  ELDEF(v.pred),
                  EL_LDATA,  ELDEF(v.succ),
                  EL_GDATA,  ELDEF(v.index),
-                 EL_GDATA,  ELDEF(v.skip),
                  EL_LDATA,  ELDEF(v.start),
 
                  /* TODO: value wird noch ausgelassen. feld variabler laenge? */
-- 
GitLab