FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FEI.hpp
1 #ifndef _FEI_hpp_
2 #define _FEI_hpp_
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 //
12 //=========================================================================
13 // public C++ interface definition for FEI, version 2.1, Jan. 25, 2001
14 //
15 // This interface header is the C++ expression of the Finite Element
16 // Interface to Linear Solvers.
17 //
18 //=========================================================================
19 //
20 // Below is a list of the functions in FEI 2.x, grouped roughly by
21 // usage categories, with the initialization and load groups (1 and 2)
22 // also reflecting common calling order.
23 //
24 //===================================================================
25 //
26 // (0) Construction
27 // ----------------
28 //
29 // <Implementation-dependent>
30 //
31 //
32 // (1) initialization
33 // ------------------
34 //
35 // parameters
36 // setIDLists
37 // initSolveStep
38 //
39 // initFields
40 // initElemBlock
41 //
42 // initElem
43 //
44 // initSharedNodes
45 //
46 // initCRMult
47 // initCRPen
48 // initSlaveVariable
49 //
50 // initComplete
51 //
52 //
53 // (2) load data
54 // -------------
55 //
56 // setLHSID
57 // setRHSID
58 //
59 // loadNodeBCs
60 // loadElemBCs
61 //
62 // sumInElem
63 // sumInElemMatrix
64 // sumInElemRHS
65 //
66 // loadCRMult
67 // loadCRPen
68 //
69 // setMatScalars
70 // setRHSScalars
71 //
72 // loadComplete
73 //
74 // (3) equation solution
75 // ---------------------
76 //
77 // residualNorm
78 // solve
79 //
80 //
81 // (4) return of solution data
82 // ---------------------------
83 //
84 // getBlockNodeSolution
85 // getBlockFieldNodeSolution
86 // getBlockElemSolution
87 // getCRMultipliers
88 //
89 // (5) initial guess 'put'ing
90 // --------------------------
91 //
92 // putBlockNodeSolution
93 // putBlockFieldNodeSolution
94 // putBlockElemSolution
95 // putCRMultParam
96 // putNodalFieldData
97 //
98 // (6) resetting functions
99 // -------------------------
100 //
101 // resetSystem
102 // resetMatrix
103 // resetRHSVector
104 // resetInitialGuess
105 // deleteMultCRs
106 //
107 // (7) query functions
108 // -------------------
109 //
110 // version
111 // cumulative_cpu_times
112 //
113 // iterations
114 // getNumSolnParams
115 // getNumElemBlocks
116 // getNumBlockActNodes
117 // getNumBlockActEqns
118 // getNumNodesPerElement
119 // getNumEqnsPerElement
120 // getNumBlockElements
121 // getNumBlockElemDOF
122 // getNumCRMultipliers
123 // getCRMultIDList
124 // getBlockNodeIDList
125 // getBlockElemIDList
126 // getFieldSize
127 // getEqnNumbers
128 // getNodalFieldSolution
129 // getNumLocalNodes
130 // getLocalNodeIDList
131 //
132 
133 #include <fei_macros.hpp>
134 #include <fei_defs.h>
135 
144 class FEI {
145 
146  public:
147 
150  virtual ~FEI() {}
151 
160  virtual int parameters(int numParams,
161  const char *const* paramStrings) = 0;
162 
179  virtual int setIDLists( int numMatrices,
180  const int* matrixIDs,
181  int numRHSs,
182  const int* rhsIDs ) = 0;
183 
184 
193  virtual int setSolveType( int solveType ) = 0;
194 
209  virtual int initFields( int numFields,
210  const int *fieldSizes,
211  const int *fieldIDs,
212  const int *fieldTypes = NULL ) = 0;
213 
235  virtual int initElemBlock( GlobalID elemBlockID,
236  int numElements,
237  int numNodesPerElement,
238  const int *numFieldsPerNode,
239  const int *const *nodalFieldIDs,
240  int numElemDofFieldsPerElement,
241  const int* elemDOFFieldIDs,
242  int interleaveStrategy ) = 0;
243 
252  virtual int initElem( GlobalID elemBlockID,
253  GlobalID elemID,
254  const GlobalID *elemConn ) = 0;
255 
271  virtual int initSharedNodes( int numSharedNodes,
272  const GlobalID *sharedNodeIDs,
273  const int *numProcsPerNode,
274  const int *const *sharingProcIDs ) = 0;
275 
284  virtual int initCRMult( int numCRNodes,
285  const GlobalID* CRNodeIDs,
286  const int *CRFieldIDs,
287  int& CRID ) = 0;
288 
297  virtual int initCRPen( int numCRNodes,
298  const GlobalID* CRNodeIDs,
299  const int *CRFieldIDs,
300  int& CRID ) = 0;
301 
349  virtual int initSlaveVariable(GlobalID slaveNodeID,
350  int slaveFieldID,
351  int offsetIntoSlaveField,
352  int numMasterNodes,
353  const GlobalID* masterNodeIDs,
354  const int* masterFieldIDs,
355  const double* weights,
356  double rhsValue) = 0;
357 
364  virtual int initComplete() = 0;
365 
366 
367 // Load Phase..........................................
368 
375  virtual int setCurrentMatrix(int matrixID) = 0;
376 
383  virtual int setCurrentRHS(int rhsID) = 0;
384 
388  virtual int resetSystem(double s=0.0) = 0;
389 
394  virtual int resetMatrix(double s=0.0) = 0;
395 
399  virtual int resetRHSVector(double s=0.0) = 0;
400 
406  virtual int resetInitialGuess(double s) = 0;
407 
412  virtual int deleteMultCRs() = 0;
413 
432  virtual int loadNodeBCs(int numNodes,
433  const GlobalID *nodeIDs,
434  int fieldID,
435  const int* offsetsIntoField,
436  const double* prescribedValues) = 0;
437 
460  virtual int loadElemBCs( int numElems,
461  const GlobalID *elemIDs,
462  int fieldID,
463  const double *const *alpha,
464  const double *const *beta,
465  const double *const *gamma ) = 0;
466 
482  virtual int sumInElem(GlobalID elemBlockID,
483  GlobalID elemID,
484  const GlobalID* elemConn,
485  const double* const* elemStiffness,
486  const double* elemLoad,
487  int elemFormat) = 0;
488 
503  virtual int sumInElemMatrix(GlobalID elemBlockID,
504  GlobalID elemID,
505  const GlobalID* elemConn,
506  const double* const* elemStiffness,
507  int elemFormat) = 0;
508 
517  virtual int sumInElemRHS(GlobalID elemBlockID,
518  GlobalID elemID,
519  const GlobalID* elemConn,
520  const double* elemLoad) = 0;
521 
531  virtual int loadCRMult(int CRMultID, int numCRNodes,
532  const GlobalID* CRNodeIDs,
533  const int* CRFieldIDs,
534  const double* CRWeights,
535  double CRValue) = 0;
536 
547  virtual int loadCRPen(int CRPenID, int numCRNodes,
548  const GlobalID* CRNodeIDs,
549  const int* CRFieldIDs,
550  const double* CRWeights,
551  double CRValue,
552  double penValue) = 0;
553 
555  virtual int putIntoRHS(int IDType,
556  int fieldID,
557  int numIDs,
558  const GlobalID* IDs,
559  const double* coefficients) = 0;
560 
562  virtual int sumIntoRHS(int IDType,
563  int fieldID,
564  int numIDs,
565  const GlobalID* IDs,
566  const double* coefficients) = 0;
567 
568  virtual int sumIntoMatrixDiagonal(int /*IDType*/,
569  int /*fieldID*/,
570  int /*numIDs*/,
571  const GlobalID* /*IDs*/,
572  const double* /*coefficients*/)
573  { return -1; }
574 
582  virtual int setMatScalars( int numScalars,
583  const int* IDs,
584  const double* scalars ) = 0;
585 
593  virtual int setRHSScalars( int numScalars,
594  const int* IDs,
595  const double* scalars) = 0;
596 
601  virtual int loadComplete(bool applyBCs=true,
602  bool globalAssemble=true) = 0;
603 
604 // Equation solution services.....................................
605 
618  virtual int residualNorm(int whichNorm, int numFields,
619  int* fieldIDs, double* norms) = 0;
620 
631  virtual int solve(int& status) = 0;
632 
633 
634 // Solution return services.......................................
635 
639  virtual int iterations(int& itersTaken) const = 0;
640 
645  virtual int getFieldSize(int fieldID, int& numScalars) = 0;
646 
659  virtual int getEqnNumbers(GlobalID ID,
660  int idType,
661  int fieldID,
662  int& numEqns,
663  int* eqnNumbers) = 0;
664 
677  virtual int getNodalFieldSolution(int fieldID,
678  int numNodes,
679  const GlobalID* nodeIDs,
680  double* results) = 0;
681 
687  virtual int getNumLocalNodes(int& numNodes) = 0;
688 
700  virtual int getLocalNodeIDList(int& numNodes,
701  GlobalID* nodeIDs,
702  int lenNodeIDs) = 0;
703 
707  virtual int putNodalFieldData(int fieldID,
708  int numNodes,
709  const GlobalID* nodeIDs,
710  const double* data) = 0;
711 
729  virtual int getBlockNodeSolution( GlobalID elemBlockID,
730  int numNodes,
731  const GlobalID *nodeIDs,
732  int *offsets,
733  double *results ) = 0;
734 
749  virtual int getNodalSolution(int numNodes,
750  const GlobalID* nodeIDs,
751  int* offsets,
752  double* results) = 0;
753 
764  virtual int getBlockFieldNodeSolution(GlobalID elemBlockID,
765  int fieldID,
766  int numNodes,
767  const GlobalID *nodeIDs,
768  double *results) = 0;
769 
779  virtual int getBlockElemSolution( GlobalID elemBlockID,
780  int numElems,
781  const GlobalID *elemIDs,
782  int& numElemDOFPerElement,
783  double *results ) = 0;
784 
789  virtual int getNumCRMultipliers(int& numMultCRs) = 0;
790 
797  virtual int getCRMultIDList(int numMultCRs, int* multIDs) = 0;
798 
806  virtual int getCRMultipliers(int numCRs,
807  const int *CRIDs,
808  double *results) = 0;
809 
810 
811 // Some 'put' methods paralleling the solution 'get' functions.
812 // the int sizing parameters are passed for error-checking purposes, so
813 // that the interface implementation can tell if the passed estimate
814 // vectors make sense -before- an attempt is made to utilize them as
815 // initial guesses by unpacking them into the solver's native solution
816 // vector format.
817 
828  virtual int putBlockNodeSolution(GlobalID elemBlockID,
829  int numNodes,
830  const GlobalID *nodeIDs,
831  const int *offsets,
832  const double *estimates) = 0;
833 
842  virtual int putBlockFieldNodeSolution(GlobalID elemBlockID,
843  int fieldID,
844  int numNodes,
845  const GlobalID *nodeIDs,
846  const double *estimates) = 0;
847 
857  virtual int putBlockElemSolution( GlobalID elemBlockID,
858  int numElems,
859  const GlobalID *elemIDs,
860  int dofPerElem,
861  const double *estimates) = 0;
862 
868  virtual int putCRMultipliers( int numMultCRs,
869  const int* CRMultIDs,
870  const double *multEstimates ) = 0;
871 
872 
873 // utility query functions..............
874 
883  virtual int getBlockNodeIDList( GlobalID elemBlockID,
884  int numNodes,
885  GlobalID *nodeIDs ) = 0;
886 
892  virtual int getBlockElemIDList(GlobalID elemBlockID,
893  int numElems,
894  GlobalID *elemIDs ) = 0;
895 
896 // miscellaneous self-explanatory query functions............
897 
906  virtual int version(const char*& versionString) = 0;
907 
915  virtual int cumulative_cpu_times(double& initPhase,
916  double& loadPhase,
917  double& solve,
918  double& solnReturn) = 0;
919 
926  virtual int getNumSolnParams( GlobalID globalNodeID,
927  int& numSolnParams) const = 0;
928 
932  virtual int getNumElemBlocks(int& numElemBlocks) const = 0;
933 
938  virtual int getNumBlockActNodes( GlobalID elemBlockID,
939  int& numNodes) const = 0;
940 
946  virtual int getNumBlockActEqns( GlobalID elemBlockID,
947  int& numEqns) const = 0;
948 
954  virtual int getNumNodesPerElement( GlobalID elemBlockID,
955  int& nodesPerElem) const = 0;
956 
962  virtual int getNumEqnsPerElement( GlobalID elemBlockID,
963  int& eqnsPerElem) const = 0;
964 
969  virtual int getNumBlockElements( GlobalID blockID,
970  int& numElems) const = 0;
971 
976  virtual int getNumBlockElemDOF( GlobalID blockID,
977  int& DOFPerElem) const = 0;
978 
979 };
980 
981 #endif
virtual int getCRMultipliers(int numCRs, const int *CRIDs, double *results)=0
virtual int initSlaveVariable(GlobalID slaveNodeID, int slaveFieldID, int offsetIntoSlaveField, int numMasterNodes, const GlobalID *masterNodeIDs, const int *masterFieldIDs, const double *weights, double rhsValue)=0
virtual int sumInElemMatrix(GlobalID elemBlockID, GlobalID elemID, const GlobalID *elemConn, const double *const *elemStiffness, int elemFormat)=0
virtual int getBlockElemIDList(GlobalID elemBlockID, int numElems, GlobalID *elemIDs)=0
virtual int loadCRPen(int CRPenID, int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, const double *CRWeights, double CRValue, double penValue)=0
virtual int getNumElemBlocks(int &numElemBlocks) const =0
virtual int parameters(int numParams, const char *const *paramStrings)=0
virtual int initComplete()=0
virtual int putBlockNodeSolution(GlobalID elemBlockID, int numNodes, const GlobalID *nodeIDs, const int *offsets, const double *estimates)=0
virtual int setMatScalars(int numScalars, const int *IDs, const double *scalars)=0
virtual int getNumCRMultipliers(int &numMultCRs)=0
virtual int loadNodeBCs(int numNodes, const GlobalID *nodeIDs, int fieldID, const int *offsetsIntoField, const double *prescribedValues)=0
virtual int solve(int &status)=0
virtual int getNumBlockActEqns(GlobalID elemBlockID, int &numEqns) const =0
virtual int getNodalFieldSolution(int fieldID, int numNodes, const GlobalID *nodeIDs, double *results)=0
virtual int getNumBlockElemDOF(GlobalID blockID, int &DOFPerElem) const =0
virtual int putNodalFieldData(int fieldID, int numNodes, const GlobalID *nodeIDs, const double *data)=0
virtual int loadCRMult(int CRMultID, int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, const double *CRWeights, double CRValue)=0
virtual int setRHSScalars(int numScalars, const int *IDs, const double *scalars)=0
virtual int getNumBlockActNodes(GlobalID elemBlockID, int &numNodes) const =0
virtual int putIntoRHS(int IDType, int fieldID, int numIDs, const GlobalID *IDs, const double *coefficients)=0
virtual int initCRMult(int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, int &CRID)=0
virtual int getNumLocalNodes(int &numNodes)=0
virtual int version(const char *&versionString)=0
virtual int loadElemBCs(int numElems, const GlobalID *elemIDs, int fieldID, const double *const *alpha, const double *const *beta, const double *const *gamma)=0
virtual int getNumEqnsPerElement(GlobalID elemBlockID, int &eqnsPerElem) const =0
Definition: FEI.hpp:144
virtual int deleteMultCRs()=0
virtual int getEqnNumbers(GlobalID ID, int idType, int fieldID, int &numEqns, int *eqnNumbers)=0
virtual int initSharedNodes(int numSharedNodes, const GlobalID *sharedNodeIDs, const int *numProcsPerNode, const int *const *sharingProcIDs)=0
virtual int setCurrentRHS(int rhsID)=0
virtual int resetInitialGuess(double s)=0
virtual int initFields(int numFields, const int *fieldSizes, const int *fieldIDs, const int *fieldTypes=NULL)=0
virtual int initElemBlock(GlobalID elemBlockID, int numElements, int numNodesPerElement, const int *numFieldsPerNode, const int *const *nodalFieldIDs, int numElemDofFieldsPerElement, const int *elemDOFFieldIDs, int interleaveStrategy)=0
virtual int getFieldSize(int fieldID, int &numScalars)=0
virtual int getNumNodesPerElement(GlobalID elemBlockID, int &nodesPerElem) const =0
virtual ~FEI()
Definition: FEI.hpp:150
virtual int setSolveType(int solveType)=0
virtual int getNumSolnParams(GlobalID globalNodeID, int &numSolnParams) const =0
virtual int resetMatrix(double s=0.0)=0
virtual int getNodalSolution(int numNodes, const GlobalID *nodeIDs, int *offsets, double *results)=0
virtual int loadComplete(bool applyBCs=true, bool globalAssemble=true)=0
virtual int getBlockElemSolution(GlobalID elemBlockID, int numElems, const GlobalID *elemIDs, int &numElemDOFPerElement, double *results)=0
virtual int resetSystem(double s=0.0)=0
virtual int sumInElemRHS(GlobalID elemBlockID, GlobalID elemID, const GlobalID *elemConn, const double *elemLoad)=0
virtual int putCRMultipliers(int numMultCRs, const int *CRMultIDs, const double *multEstimates)=0
virtual int resetRHSVector(double s=0.0)=0
virtual int getBlockFieldNodeSolution(GlobalID elemBlockID, int fieldID, int numNodes, const GlobalID *nodeIDs, double *results)=0
virtual int getBlockNodeSolution(GlobalID elemBlockID, int numNodes, const GlobalID *nodeIDs, int *offsets, double *results)=0
virtual int getBlockNodeIDList(GlobalID elemBlockID, int numNodes, GlobalID *nodeIDs)=0
virtual int residualNorm(int whichNorm, int numFields, int *fieldIDs, double *norms)=0
virtual int setIDLists(int numMatrices, const int *matrixIDs, int numRHSs, const int *rhsIDs)=0
virtual int iterations(int &itersTaken) const =0
virtual int setCurrentMatrix(int matrixID)=0
virtual int sumInElem(GlobalID elemBlockID, GlobalID elemID, const GlobalID *elemConn, const double *const *elemStiffness, const double *elemLoad, int elemFormat)=0
virtual int getLocalNodeIDList(int &numNodes, GlobalID *nodeIDs, int lenNodeIDs)=0
virtual int putBlockFieldNodeSolution(GlobalID elemBlockID, int fieldID, int numNodes, const GlobalID *nodeIDs, const double *estimates)=0
virtual int sumIntoRHS(int IDType, int fieldID, int numIDs, const GlobalID *IDs, const double *coefficients)=0
virtual int initElem(GlobalID elemBlockID, GlobalID elemID, const GlobalID *elemConn)=0
virtual int getCRMultIDList(int numMultCRs, int *multIDs)=0
virtual int initCRPen(int numCRNodes, const GlobalID *CRNodeIDs, const int *CRFieldIDs, int &CRID)=0
virtual int putBlockElemSolution(GlobalID elemBlockID, int numElems, const GlobalID *elemIDs, int dofPerElem, const double *estimates)=0
virtual int getNumBlockElements(GlobalID blockID, int &numElems) const =0
virtual int cumulative_cpu_times(double &initPhase, double &loadPhase, double &solve, double &solnReturn)=0