/[escript]/branches/trilinos_from_5897/dudley/src/ElementFile_jacobians.cpp
ViewVC logotype

Diff of /branches/trilinos_from_5897/dudley/src/ElementFile_jacobians.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6078 by caltinay, Wed Mar 2 04:13:26 2016 UTC revision 6079 by caltinay, Mon Mar 21 12:22:38 2016 UTC
# Line 20  Line 20 
20    
21  namespace dudley {  namespace dudley {
22    
23  Dudley_ElementFile_Jacobians *Dudley_ElementFile_Jacobians_alloc(void)  ElementFile_Jacobians::ElementFile_Jacobians() :
24        status(DUDLEY_INITIAL_STATUS - 1),
25        numDim(0),
26        numQuad(0),
27        numElements(0),
28        absD(NULL),
29        quadweight(0),
30        DSDX(NULL)
31  {  {
     Dudley_ElementFile_Jacobians *out = new Dudley_ElementFile_Jacobians;  
     out->status = DUDLEY_INITIAL_STATUS - 1;  
     out->numDim = 0;  
     out->numQuad = 0;  
     out->numElements = 0;  
     out->absD = NULL;  
     out->quadweight = 0;  
     out->DSDX = NULL;  
     return out;  
32  }  }
33    
34  void Dudley_ElementFile_Jacobians_dealloc(Dudley_ElementFile_Jacobians * in)  ElementFile_Jacobians::~ElementFile_Jacobians()
35  {  {
36      if (in != NULL)      delete[] DSDX;
37      {      delete[] absD;
         delete[] in->DSDX;  
         delete[] in->absD;  
         delete in;  
     }  
38  }  }
39    
40  Dudley_ElementFile_Jacobians *Dudley_ElementFile_borrowJacobians(  ElementFile_Jacobians* ElementFile::borrowJacobians(const NodeFile* nodes,
41                   const Dudley_ElementFile* self, const Dudley_NodeFile* nodes,                                             bool reducedIntegrationOrder) const
                  bool reducedIntegrationOrder)  
42  {  {
43      Dudley_ElementFile_Jacobians *out = NULL;      ElementFile_Jacobians* out =
44                    (reducedIntegrationOrder ? jacobians_reducedQ : jacobians);
     dim_t numNodes = self->numNodes;  
45    
46      if (reducedIntegrationOrder)      if (out->status < nodes->status) {
     {  
         out = self->jacobians_reducedQ;  
     }  
     else  
     {  
         out = self->jacobians;  
     }  
     if (out->status < nodes->status)  
     {  
47          out->numDim = nodes->numDim;          out->numDim = nodes->numDim;
48          out->numQuad = QuadNums[self->numDim][!reducedIntegrationOrder];          out->numQuad = QuadNums[numDim][!reducedIntegrationOrder];
49          out->numShapes = self->numDim + 1;          out->numShapes = numDim + 1;
50          out->numElements = self->numElements;          out->numElements = numElements;
51          if (out->DSDX == NULL)          if (out->DSDX == NULL)
52              out->DSDX = new  double[(out->numElements) * (out->numShapes) * (out->numDim) * (out->numQuad)];              out->DSDX = new double[out->numElements * out->numShapes * out->numDim * out->numQuad];
53          if (out->absD == NULL)          if (out->absD == NULL)
54              out->absD = new  double[out->numElements];              out->absD = new double[out->numElements];
55    
         /*========================== dim = 1 ============================= */  
         if (out->numDim == 1) {  
             throw DudleyException("Dudley does not support 1D domains.");  
56          /*========================== dim = 2 ============================= */          /*========================== dim = 2 ============================= */
57          } else if (out->numDim == 2) {          if (out->numDim == 2) {
58              if (self->numLocalDim == 1) {              if (numLocalDim == 1) {
59                  dudley::Assemble_jacobians_2D_M1D_E1D(nodes->Coordinates, out->numQuad, self->numElements, numNodes,                  Assemble_jacobians_2D_M1D_E1D(nodes->Coordinates, out->numQuad,
60                                                self->Nodes, out->DSDX, out->absD, &(out->quadweight), self->Id);                          numElements, numNodes, Nodes, out->DSDX, out->absD,
61              } else if (self->numLocalDim == 2) {                          &out->quadweight, Id);
62                  dudley::Assemble_jacobians_2D(nodes->Coordinates, out->numQuad, self->numElements, numNodes, self->Nodes,              } else if (numLocalDim == 2) {
63                                        out->DSDX, out->absD, &(out->quadweight), self->Id);                  Assemble_jacobians_2D(nodes->Coordinates, out->numQuad,
64                            numElements, numNodes, Nodes, out->DSDX, out->absD,
65                            &out->quadweight, Id);
66              } else {              } else {
67                  throw DudleyException("Dudley_ElementFile_borrowJacobians: local dimension in a 2D domain has to be 1 or 2.");                  throw DudleyException("ElementFile::borrowJacobians: local "
68                                    "dimension in a 2D domain has to be 1 or 2.");
69              }              }
70          /*========================== dim = 3 ============================= */          /*========================== dim = 3 ============================= */
71          } else if (out->numDim == 3) {          } else if (out->numDim == 3) {
72              if (self->numLocalDim == 2) {              if (numLocalDim == 2) {
73                  dudley::Assemble_jacobians_3D_M2D_E2D(nodes->Coordinates, out->numQuad, self->numElements, numNodes,                  Assemble_jacobians_3D_M2D_E2D(nodes->Coordinates, out->numQuad,
74                                                self->Nodes, out->DSDX, out->absD, &(out->quadweight), self->Id);                          numElements, numNodes, Nodes, out->DSDX, out->absD,
75              } else if (self->numLocalDim == 3) {                          &out->quadweight, Id);
76                  dudley::Assemble_jacobians_3D(nodes->Coordinates, out->numQuad, self->numElements, numNodes, self->Nodes,              } else if (numLocalDim == 3) {
77                                        out->DSDX, out->absD, &(out->quadweight), self->Id);                  Assemble_jacobians_3D(nodes->Coordinates, out->numQuad,
78                            numElements, numNodes, Nodes, out->DSDX, out->absD,
79                            &out->quadweight, Id);
80              } else {              } else {
81                  throw DudleyException("Dudley_ElementFile_borrowJacobians: local dimension in a 3D domain has to be 2 or 3.");                  throw DudleyException("ElementFile::borrowJacobians: local "
82                                    "dimension in a 3D domain has to be 2 or 3.");
83              }              }
84          } else {          } else {
85              throw DudleyException("Dudley_ElementFile_borrowJacobians: spatial dimension has to be 1, 2 or 3.");              throw DudleyException("ElementFile::borrowJacobians: number of "
86                                      "spatial dimensions has to be 2 or 3.");
87          }          }
88          out->status = nodes->status;          out->status = nodes->status;
89      }      }

Legend:
Removed from v.6078  
changed lines
  Added in v.6079

  ViewVC Help
Powered by ViewVC 1.1.26