FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PoissonData.hpp
1 #ifndef _PoissonData_h_
2 #define _PoissonData_h_
3 /*--------------------------------------------------------------------*/
4 /* Copyright 2005 Sandia Corporation. */
5 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
6 /* non-exclusive license for use of this work by or on behalf */
7 /* of the U.S. Government. Export of this program may require */
8 /* a license from the United States Government. */
9 /*--------------------------------------------------------------------*/
10 
11 #include <fei_base.hpp>
12 //
13 //This is a class for use in exercising FEI implementations.
14 //
15 //This class sets up test data for the Poisson equation on a 2D square,
16 //and provides query functions for obtaining that data.
17 //
18 //The calling program (the 'user' of PoissonData) is left
19 //with the task of calling the FEI functions.
20 //
21 //Also note:
22 //
23 // 1. This class only provides 1 element-block per processor currently.
24 // 2. The function calculateBCs() must be called before the boundary
25 // condition data is requested.
26 //
27 // Alan Williams 12-20-2000
28 //
29 
30 class PoissonData {
31  public:
32  //constructor -- see PoissonData.cpp for descriptions of these
33  //parameters.
34  PoissonData(int L,
35  int numProcs, int localProc, int outputLevel);
36 
37  //destructor.
38  ~PoissonData();
39 
40  int getElemFormat() {return(elemFormat_); };
41 
42  //hardwired for only 1 field...
43  int getNumFields() { return(1);};
44  int* getFieldSizes() { return(&fieldSize_);};
45  int* getFieldIDs() { return(&fieldIDs_[0][0]);};
46 
47  GlobalID getElemBlockID() { return(elemBlockID_); };
48 
49  int getNumLocalElements() { return(numLocalElements_); };
50  GlobalID* getLocalElementIDs() { return(elemIDs_); };
51  int getNumNodesPerElement() { return(elem_->numElemNodes()); };
52 
53  int* getNumFieldsPerNodeList() { return( numFields_ ); };
54  int** getNodalFieldIDsTable() { return( fieldIDs_ ); };
55 
56  GlobalID* getElementConnectivity(GlobalID elemID);
57 
58  double** getElemStiffness(GlobalID elemID);
59  double* getElemLoad(GlobalID elemID);
60 
61  void addBCNode(GlobalID nodeID, double x, double y);
62 
63  void calculateBCs();
64 
65  int getNumBCNodes() { return( BCNodeIDs_.size() ); }
66  GlobalID* getBCNodeIDs() { return( &BCNodeIDs_[0] ); }
67  int getBCFieldID() { return( fieldIDs_[0][0] ); }
68  double* getBCValues() { return( &BCValues_[0] ); }
69 
70 
71  void getLeftSharedNodes(int& numShared, GlobalID* sharedNodeIDs,
72  int* numProcsPerSharedNode,
73  int** sharingProcs);
74  void getRightSharedNodes(int& numShared, GlobalID* sharedNodeIDs,
75  int* numProcsPerSharedNode,
76  int** sharingProcs);
77  void getTopSharedNodes(int& numShared, GlobalID* sharedNodeIDs,
78  int* numProcsPerSharedNode,
79  int** sharingProcs);
80  void getBottomSharedNodes(int& numShared, GlobalID* sharedNodeIDs,
81  int* numProcsPerSharedNode,
82  int** sharingProcs);
83  private:
84  void check1();
85  void calculateDistribution();
86 
87  void messageAbort(const char* message);
88 
89  void calculateConnectivity(GlobalID* conn, int size, GlobalID elemID);
90  void initializeFieldStuff();
91  void deleteFieldArrays();
92 
93  void printSharedNodes(const char* str,
94  int numShared,
95  GlobalID* nodeIDs,
96  int** shareProcs,
97  int* numShareProcs);
98 
99  Poisson_Elem* elem_; //we're only going to have 1 element instance!!
100  int numLocalElements_;
101  int startElement_;
102 
103  int numProcs_;
104  int localProc_;
105  int outputLevel_;
106 
107  int L_;
108  int procX_, procY_;
109  int maxProcX_, maxProcY_;
110 
111  int numElemBlocks_;
112  int solveType_;
113 
114  int nodesPerElement_;
115  int fieldsPerNode_;
116  GlobalID elemBlockID_;
117  int elemSetID_;
118  int elemFormat_;
119 
120  //*************** field description variables *********
121  int fieldSize_;
122  int* numFields_;
123  int** fieldIDs_;
124  bool fieldArraysAllocated_;
125 
126  //************* element IDs and connectivities ********
127  GlobalID* elemIDs_;
128  bool elemIDsAllocated_;
129 
130  //************* boundary condition stuff **************
131  std::vector<GlobalID> BCNodeIDs_;
132  std::vector<double> BCValues_;
133 };
134 
135 int init_elem_connectivities(FEI* fei, PoissonData& poissonData);
136 
137 int init_elem_connectivities(fei::MatrixGraph* matrixGraph,
138  PoissonData& poissonData);
139 
140 int set_shared_nodes(FEI* fei, PoissonData& poissonData);
141 
142 int set_shared_nodes(fei::VectorSpace* nodeSpace, PoissonData& poissonData);
143 
144 int load_elem_data(FEI* fei, PoissonData& poissonData);
145 
146 int load_elem_data_putrhs(FEI* fei, PoissonData& poissonData);
147 
148 int load_elem_data(fei::MatrixGraph* matrixGraph,
149  fei::Matrix* mat, fei::Vector* rhs,
150  PoissonData& poissonData);
151 
152 int load_BC_data(FEI* fei, PoissonData& poissonData);
153 
154 int load_BC_data(fei::LinearSystem* linSys, PoissonData& poissonData);
155 
156 #endif
157 
Definition: FEI.hpp:144