/[escript]/branches/doubleplusgood/finley/src/ReferenceElements.cpp
ViewVC logotype

Diff of /branches/doubleplusgood/finley/src/ReferenceElements.cpp

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

revision 4326 by jfenwick, Wed Feb 27 06:09:33 2013 UTC revision 4327 by jfenwick, Wed Mar 20 05:09:11 2013 UTC
# Line 602  Finley_ReferenceElement* Finley_Referenc Line 602  Finley_ReferenceElement* Finley_Referenc
602                    
603            
604            
605      out=MEMALLOC(1,Finley_ReferenceElement);      out=new Finley_ReferenceElement;
606      if (Finley_checkPtr(out)) return NULL;      if (Finley_checkPtr(out)) return NULL;
607            
608      out->reference_counter=0;      out->reference_counter=0;
# Line 634  Finley_ReferenceElement* Finley_Referenc Line 634  Finley_ReferenceElement* Finley_Referenc
634    
635      numQuadNodes=quadscheme->getNumQuadNodes(order);      numQuadNodes=quadscheme->getNumQuadNodes(order);
636            
637      quadNodes=MEMALLOC(numQuadNodes*quadscheme->numDim*nsub,double);      quadNodes=new double[numQuadNodes*quadscheme->numDim*nsub];
638      quadWeights=MEMALLOC(numQuadNodes*nsub,double);      quadWeights=new double[numQuadNodes*nsub];  
639      if ( !( Finley_checkPtr(quadNodes) || Finley_checkPtr(quadWeights) ) ) {      if ( !( Finley_checkPtr(quadNodes) || Finley_checkPtr(quadWeights) ) ) {
640            
641          quadscheme->getQuadNodes(numQuadNodes, quadNodes, quadWeights);          quadscheme->getQuadNodes(numQuadNodes, quadNodes, quadWeights);
# Line 650  Finley_ReferenceElement* Finley_Referenc Line 650  Finley_ReferenceElement* Finley_Referenc
650           */           */
651            
652          if (nsub>1) {          if (nsub>1) {
653                          out->DBasisFunctionDv=MEMALLOC(numQuadNodes*nsub* (basisfunction->numShapes) * (basisfunction->numDim), double );                          out->DBasisFunctionDv=new  double [numQuadNodes*nsub* (basisfunction->numShapes) * (basisfunction->numDim)];
654                          out->DBasisFunctionDvShared=FALSE;                          out->DBasisFunctionDvShared=FALSE;
655                                                    
656                  out->BasisFunctions=Finley_ShapeFunction_alloc(basisfunction->TypeId, quadscheme->numDim, numQuadNodes, quadNodes, quadWeights);                  out->BasisFunctions=Finley_ShapeFunction_alloc(basisfunction->TypeId, quadscheme->numDim, numQuadNodes, quadNodes, quadWeights);
657              quadNodes2=MEMALLOC(numQuadNodes*quadscheme->numDim*nsub,double);              quadNodes2=new double[numQuadNodes*quadscheme->numDim*nsub];
658              quadWeights2=MEMALLOC(numQuadNodes*nsub,double);              quadWeights2=new double[numQuadNodes*nsub];
659              if ( !( Finley_checkPtr(quadNodes2) || Finley_checkPtr(quadWeights2) || Finley_checkPtr(out->DBasisFunctionDv)) ) {              if ( !( Finley_checkPtr(quadNodes2) || Finley_checkPtr(quadWeights2) || Finley_checkPtr(out->DBasisFunctionDv)) ) {
660    
661                  numQuadNodes2=quadscheme->getMacro(nsub,out->BasisFunctions->numQuadNodes,                  numQuadNodes2=quadscheme->getMacro(nsub,out->BasisFunctions->numQuadNodes,
# Line 670  Finley_ReferenceElement* Finley_Referenc Line 670  Finley_ReferenceElement* Finley_Referenc
670                  }                  }
671                                    
672              }              }
673              MEMFREE(quadNodes2);              delete[] quadNodes2;
674              MEMFREE(quadWeights2);              delete[] quadWeights2;
675                            
676          } else {          } else {
677              out->Parametrization=Finley_ShapeFunction_alloc(parametrization->TypeId, quadscheme->numDim, numQuadNodes*nsub, quadNodes, quadWeights);              out->Parametrization=Finley_ShapeFunction_alloc(parametrization->TypeId, quadscheme->numDim, numQuadNodes*nsub, quadNodes, quadWeights);
# Line 681  Finley_ReferenceElement* Finley_Referenc Line 681  Finley_ReferenceElement* Finley_Referenc
681                          out->DBasisFunctionDvShared=TRUE;                          out->DBasisFunctionDvShared=TRUE;
682          }          }
683      }      }
684      MEMFREE(quadNodes);      delete[] quadNodes;
685      MEMFREE(quadWeights);      delete[] quadWeights;
686      if (Finley_noError()) {      if (Finley_noError()) {
687          return Finley_ReferenceElement_reference(out);          return Finley_ReferenceElement_reference(out);
688      } else {      } else {
# Line 700  void Finley_ReferenceElement_dealloc(Fin Line 700  void Finley_ReferenceElement_dealloc(Fin
700              Finley_ShapeFunction_dealloc(in->Parametrization);              Finley_ShapeFunction_dealloc(in->Parametrization);
701              Finley_ShapeFunction_dealloc(in->BasisFunctions);              Finley_ShapeFunction_dealloc(in->BasisFunctions);
702              Finley_ShapeFunction_dealloc(in->LinearBasisFunctions);              Finley_ShapeFunction_dealloc(in->LinearBasisFunctions);
703                          if (! in->DBasisFunctionDvShared) MEMFREE(in->DBasisFunctionDv);                          if (! in->DBasisFunctionDvShared) delete[] in->DBasisFunctionDv;
704              MEMFREE(in);              delete in;
705          }          }
706      }      }
707    

Legend:
Removed from v.4326  
changed lines
  Added in v.4327

  ViewVC Help
Powered by ViewVC 1.1.26