MFEM v2.0
sets.hpp
Go to the documentation of this file.
00001 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
00002 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
00003 // reserved. See file COPYRIGHT for details.
00004 //
00005 // This file is part of the MFEM library. For more information and source code
00006 // availability see http://mfem.googlecode.com.
00007 //
00008 // MFEM is free software; you can redistribute it and/or modify it under the
00009 // terms of the GNU Lesser General Public License (as published by the Free
00010 // Software Foundation) version 2.1 dated February 1999.
00011 
00012 #ifndef MFEM_SETS
00013 #define MFEM_SETS
00014 
00016 class IntegerSet
00017 {
00018 private:
00019    Array<int> me;
00020 
00021 public:
00022    IntegerSet() { }
00023 
00024    IntegerSet(IntegerSet &s);
00025 
00026    IntegerSet(const int n, const int *p) { Recreate(n, p); }
00027 
00028    int Size() { return me.Size(); }
00029 
00030    operator Array<int>& () { return me; }
00031 
00032    int PickElement() { return me[0]; }
00033 
00034    int PickRandomElement();
00035 
00036    int operator==(IntegerSet &s);
00037 
00038    void Recreate(const int n, const int *p);
00039 };
00040 
00042 class ListOfIntegerSets
00043 {
00044 private:
00045    Array<IntegerSet *> TheList;
00046 
00047 public:
00048 
00049    int Size() { return TheList.Size(); }
00050 
00051    int PickElementInSet(int i) { return TheList[i]->PickElement(); }
00052 
00053    int PickRandomElementInSet(int i) { return TheList[i]->PickRandomElement(); }
00054 
00055    int Insert(IntegerSet &s);
00056 
00057    int Lookup(IntegerSet &s);
00058 
00059    void AsTable(Table &t);
00060 
00061    ~ListOfIntegerSets();
00062 };
00063 
00064 #endif
00065 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines