From 7c6036aa09c46cd47ab6e3a1317031f8fb58f92e Mon Sep 17 00:00:00 2001
From: Ansgar Burchardt <Ansgar.Burchardt@tu-dresden.de>
Date: Wed, 5 Apr 2017 18:20:26 +0200
Subject: [PATCH] Remove functions to modify and query selection

---
 gm/gm.h   |  12 --
 gm/ugm.cc | 362 ------------------------------------------------------
 2 files changed, 374 deletions(-)

diff --git a/gm/gm.h b/gm/gm.h
index 188be1d4f..6df6490d4 100644
--- a/gm/gm.h
+++ b/gm/gm.h
@@ -3518,18 +3518,6 @@ INT                     CheckGrid                               (GRID *theGrid,
 INT                     CheckLists                              (GRID *theGrid);
 INT             CheckSubdomains                 (MULTIGRID *theMG);
 
-/* selection */
-void            ClearSelection                  (MULTIGRID *theMG);
-INT             AddNodeToSelection              (MULTIGRID *theMG, NODE *theNode);
-INT             IsNodeSelected                  (MULTIGRID *theMG, NODE *theNode);
-INT             AddElementToSelection   (MULTIGRID *theMG, ELEMENT *theElement);
-INT             IsElementSelected               (const MULTIGRID *theMG, const ELEMENT *theElement);
-INT             AddVectorToSelection    (MULTIGRID *theMG, VECTOR *theVector);
-INT             IsVectorSelected                (const MULTIGRID *theMG, const VECTOR *theVector);
-INT             RemoveNodeFromSelection (MULTIGRID *theMG, NODE *theNode);
-INT             RemoveElementFromSelection(MULTIGRID *theMG, ELEMENT *theElement);
-INT             RemoveVectorFromSelection(MULTIGRID *theMG, VECTOR *theVector);
-
 /* multigrid user data space management (using the heaps.c block heap management) */
 INT             AllocateControlEntry    (INT cw_id, INT length, INT *ce_id);
 INT             FreeControlEntry                (INT ce_id);
diff --git a/gm/ugm.cc b/gm/ugm.cc
index d4719111e..c25f500fd 100644
--- a/gm/ugm.cc
+++ b/gm/ugm.cc
@@ -8375,33 +8375,6 @@ void NS_DIM_PREFIX ListNodeSelection (MULTIGRID *theMG, INT dataopt, INT bopt, I
 }
 
 
-/****************************************************************************/
-/** \brief Check if element is in selection list
- *
- * @param   theMG - multigrid structure
- * @param   theNode - node to check
- *
- * This function checks if an element is in the selection list.
- *
- * @return <ul>
- * <li>   0 if NOT in list
- * <li>   1 if in list.
- * </ul>
- */
-/****************************************************************************/
-
-INT NS_DIM_PREFIX IsNodeSelected (MULTIGRID *theMG, NODE *theNode)
-{
-  int j;
-
-  if (SELECTIONMODE(theMG) != nodeSelection) return (0);
-  for(j=0; j<SELECTIONSIZE(theMG); j++)
-    if (theNode == (NODE *) SELECTIONOBJECT(theMG,j))
-      return (1);
-  return (0);
-}
-
-
 /****************************************************************************/
 /** \brief List information about nodes in given range of ids
 
@@ -8590,32 +8563,6 @@ void NS_DIM_PREFIX ListElementSelection (const MULTIGRID *theMG, INT dataopt, IN
 }
 
 
-/****************************************************************************/
-/** \brief Check whether element is in selection list
-
- * @param   theMG - multigrid structure
- * @param   theElement - element to check
-
-   This function checks whether an element is in the selection list.
-
-   @return <ul>
-   <li>   0 if NOT in list </li>
-   <li>   1 if in list.  </li>
-   </ul> */
-/****************************************************************************/
-
-INT NS_DIM_PREFIX IsElementSelected (const MULTIGRID *theMG, const ELEMENT *theElement)
-{
-  int j;
-
-  if (SELECTIONMODE(theMG) != elementSelection) return (0);
-  for(j=0; j<SELECTIONSIZE(theMG); j++)
-    if (theElement == (ELEMENT *) SELECTIONOBJECT(theMG,j))
-      return (1);
-  return (0);
-}
-
-
 /****************************************************************************/
 /** \brief List information about elements in range of ids
 
@@ -8888,31 +8835,6 @@ void NS_DIM_PREFIX ListVectorSelection (const MULTIGRID *theMG, INT matrixopt, I
   }
 }
 
-/****************************************************************************/
-/** \brief Check whether vector is in selection list
-
- * @param   theMG - multigrid structure
- * @param   theVector - vector to check
-
-   This function checks whether an element is in the selection list.
-
-   @return <ul>
-   <li>   0 if NOT in list </li>
-   <li>   1 if in list.  </li>
-   </ul> */
-/****************************************************************************/
-
-INT NS_DIM_PREFIX IsVectorSelected (const MULTIGRID *theMG, const VECTOR *theVector)
-{
-  int j;
-
-  if (SELECTIONMODE(theMG) != vectorSelection) return (0);
-  for(j=0; j<SELECTIONSIZE(theMG); j++)
-    if (theVector == (VECTOR *) SELECTIONOBJECT(theMG,j))
-      return (1);
-  return (0);
-}
-
 /****************************************************************************/
 /** \brief List information about vectors in range of ids
 
@@ -8962,290 +8884,6 @@ void NS_DIM_PREFIX ListVectorRange (const MULTIGRID *theMG, INT fl, INT tl, INT
       }
 }
 
-/****************************************************************************/
-/** \brief Clear selection buffer
-
- * @param   theMG - multigrid structure
-
-   This function clears the selection buffer of a multigrid.
-
- */
-/****************************************************************************/
-
-
-void NS_DIM_PREFIX ClearSelection (MULTIGRID *theMG)
-{
-  SELECTIONSIZE(theMG) = 0;
-}
-
-
-/****************************************************************************/
-/** \brief Add node to selection buffer
- *
- * @param theMG multigrid structure
- * @param theNode node to add
- *
- * This function adds an node to the selection buffer or removes it if it is already
- * in the list.
- *
- * @return <ul>
- * <li>   GM_OK if ok </li>
- * <li>   GM_ERROR if an  error occured. </li>
- * </ul>
- */
-/****************************************************************************/
-
-INT NS_DIM_PREFIX AddNodeToSelection (MULTIGRID *theMG, NODE *theNode)
-{
-  int i;
-  SELECTION_OBJECT *g;
-
-  if (SELECTIONSIZE(theMG)!=0)
-  {
-    if (SELECTIONMODE(theMG)!=nodeSelection) return(GM_ERROR);
-  }
-  else SELECTIONMODE(theMG) = nodeSelection;
-
-  g = (SELECTION_OBJECT *) theNode;
-  for (i=0; i<SELECTIONSIZE(theMG); i++)
-    if (SELECTIONOBJECT(theMG,i)==g)
-    {
-      /* remove g from list (replace it with last object) */
-      SELECTIONSIZE(theMG)--;
-      SELECTIONOBJECT(theMG,i) = SELECTIONOBJECT(theMG,SELECTIONSIZE(theMG));
-      return(GM_OK);
-    }
-
-  if (SELECTIONSIZE(theMG)>=MAXSELECTION) return(GM_ERROR);
-
-  SELECTIONOBJECT(theMG,SELECTIONSIZE(theMG)) = g;
-  SELECTIONSIZE(theMG)++;
-  return(GM_OK);
-}
-
-
-/****************************************************************************/
-/** \brief Add element to selection buffer
- *
- * @param theMG multigrid structure
- * @param theElement element to add
- *
- * This function adds an element to the selection buffer or removes it if it is already
- * in the list.
- *
- * @return <ul>
- *    <li> GM_OK if ok </li>
- *    <li> GM_ERROR if an  error occured </li>
- * </ul>
- */
-/****************************************************************************/
-
-INT NS_DIM_PREFIX AddElementToSelection (MULTIGRID *theMG, ELEMENT *theElement)
-{
-  int i;
-  SELECTION_OBJECT *g;
-
-  if (SELECTIONSIZE(theMG)!=0)
-  {
-    if (SELECTIONMODE(theMG)!=elementSelection) return(GM_ERROR);
-  }
-  else SELECTIONMODE(theMG) = elementSelection;
-
-  g = (SELECTION_OBJECT *) theElement;
-  for (i=0; i<SELECTIONSIZE(theMG); i++)
-    if (SELECTIONOBJECT(theMG,i)==g)
-    {
-      /* remove g from list (replace it with last object) */
-      SELECTIONSIZE(theMG)--;
-      SELECTIONOBJECT(theMG,i) = SELECTIONOBJECT(theMG,SELECTIONSIZE(theMG));
-      return(GM_OK);
-    }
-
-  if (SELECTIONSIZE(theMG)>=MAXSELECTION)
-    return(GM_ERROR);
-
-  SELECTIONOBJECT(theMG,SELECTIONSIZE(theMG)) = g;
-  SELECTIONSIZE(theMG)++;
-  return(GM_OK);
-}
-
-/**************************************************************/
-/** \brief Add vector to selection buffer
- *
- * @param theMG multigrid structure
- * @param theVector vector to add
- *
- * This function adds a vector to the selection buffer or removes it if it is already
- * in the list.
- *
- * @return <ul>
- *   <li>   GM_OK if ok </li>
- *   <li>   GM_ERROR if an  error occured. </li>
- * </ul>
- */
-/****************************************************************************/
-
-INT NS_DIM_PREFIX AddVectorToSelection (MULTIGRID *theMG, VECTOR *theVector)
-{
-  int i;
-  SELECTION_OBJECT *g;
-
-  if (SELECTIONSIZE(theMG)!=0)
-  {
-    if (SELECTIONMODE(theMG)!=vectorSelection) return(GM_ERROR);
-  }
-  else SELECTIONMODE(theMG) = vectorSelection;
-
-  g = (SELECTION_OBJECT *) theVector;
-  for (i=0; i<SELECTIONSIZE(theMG); i++)
-    if (SELECTIONOBJECT(theMG,i)==g)
-    {
-      /* remove g from list (replace it with last object) */
-      SELECTIONSIZE(theMG)--;
-      SELECTIONOBJECT(theMG,i) = SELECTIONOBJECT(theMG,SELECTIONSIZE(theMG));
-      return(GM_OK);
-    }
-
-  if (SELECTIONSIZE(theMG)>=MAXSELECTION) return(GM_ERROR);
-
-  SELECTIONOBJECT(theMG,SELECTIONSIZE(theMG)) = g;
-  SELECTIONSIZE(theMG)++;
-  return(GM_OK);
-}
-
-/****************************************************************************/
-/*
-   RemoveNodeFromSelection - Remove node from selection buffer
-
- * @param   theMG - multigrid structure
- * @param   theNode - node to remove
-
-   This function removes an node from the selection buffer.
-
-   @return <ul>
-   <li>   GM_OK if ok </li>
-   <li>   GM_ERROR if an error occured. </li>
-   </ul> */
-/****************************************************************************/
-
-INT NS_DIM_PREFIX RemoveNodeFromSelection (MULTIGRID *theMG, NODE *theNode)
-{
-  int i,j,found;
-  SELECTION_OBJECT *g;
-
-  if (SELECTIONSIZE(theMG)>0)
-  {
-    if (SELECTIONMODE(theMG)!=nodeSelection) return(GM_ERROR);
-  }
-  else return(GM_ERROR);
-
-  g = (SELECTION_OBJECT *) theNode;
-  found = 0;
-  for (i=0; i<SELECTIONSIZE(theMG); i++)
-    if (SELECTIONOBJECT(theMG,i)==g)
-    {
-      found = 1;
-      break;
-    }
-
-  if (!found) return(GM_ERROR);
-
-  for (j=i+1; j<SELECTIONSIZE(theMG); j++)
-    SELECTIONOBJECT(theMG,j-1) = SELECTIONOBJECT(theMG,j);
-
-  SELECTIONSIZE(theMG)--;
-  return(GM_OK);
-}
-
-
-/****************************************************************************/
-/*
-   RemoveElementFromSelection - Remove element from selection buffer
-
- * @param   theMG - multigrid structure
- * @param   theElement - element to remove
-
-   This function removes an element from the selection buffer.
-
-   @return <ul>
-   INT
-   <li>   GM_OK if ok </li>
-   <li>   GM_ERROR if an error occured. </li>
-   </ul> */
-/****************************************************************************/
-
-INT NS_DIM_PREFIX RemoveElementFromSelection (MULTIGRID *theMG, ELEMENT *theElement)
-{
-  int i,j,found;
-  SELECTION_OBJECT *g;
-
-  if (SELECTIONSIZE(theMG)>0)
-  {
-    if (SELECTIONMODE(theMG)!=elementSelection) return(GM_ERROR);
-  }
-  else return(GM_ERROR);
-
-  g = (SELECTION_OBJECT *) theElement;
-  found = 0;
-  for (i=0; i<SELECTIONSIZE(theMG); i++)
-    if (SELECTIONOBJECT(theMG,i)==g)
-    {
-      found = 1;
-      break;
-    }
-
-  if (!found) return(GM_ERROR);
-
-  for (j=i+1; j<SELECTIONSIZE(theMG); j++)
-    SELECTIONOBJECT(theMG,j-1) = SELECTIONOBJECT(theMG,j);
-
-  SELECTIONSIZE(theMG)--;
-  return(GM_OK);
-}
-
-/****************************************************************************/
-/*
-   RemoveVectorFromSelection - Remove vector from selection buffer
-
- * @param   theMG - multigrid structure
- * @param   theVector - vector to remove
-
-   This function removes a vector from the selection buffer.
-
-   @return <ul>
-   <li>   GM_OK if ok </li>
-   <li>   GM_ERROR if an error occured. </li>
-   </ul> */
-/****************************************************************************/
-
-INT NS_DIM_PREFIX RemoveVectorFromSelection (MULTIGRID *theMG, VECTOR *theVector)
-{
-  int i,j,found;
-  SELECTION_OBJECT *g;
-
-  if (SELECTIONSIZE(theMG)>0)
-  {
-    if (SELECTIONMODE(theMG)!=vectorSelection) return(GM_ERROR);
-  }
-  else return(GM_ERROR);
-
-  g = (SELECTION_OBJECT *) theVector;
-  found = 0;
-  for (i=0; i<SELECTIONSIZE(theMG); i++)
-    if (SELECTIONOBJECT(theMG,i)==g)
-    {
-      found = 1;
-      break;
-    }
-
-  if (!found) return(GM_ERROR);
-
-  for (j=i+1; j<SELECTIONSIZE(theMG); j++)
-    SELECTIONOBJECT(theMG,j-1) = SELECTIONOBJECT(theMG,j);
-
-  SELECTIONSIZE(theMG)--;
-  return(GM_OK);
-}
 /****************************************************************************/
 /** \todo Please doc me!
    GetAngle -
-- 
GitLab