# [Numpy-discussion] Can this function by Numpy-ized?

Rob europax at home.com
Sun Aug 26 11:38:56 EDT 2001

```I finally got my FEM EM code working.  I profiled it and this function
uses up a big hunk of time.  It performs gaussian integration over a
triangle.  I am trying to figure out how to slice the arrays so as to
push it down into the C level.  Does anyone have any ideas?  Thanks,
Rob.

ps. it looks to be intractible to me.  Maybe I need to look at writing a
C extension.  I've never done that before.

##***************************************************************************
##Prototype:  void  ComputeGaussQuadPoint(int QuadPoint, int
*a.TrngleNode,
##                                            double *SrcPointCol)
##Description: To compute the coordinates of 7-point Gauss nodes of
##             a triangular patch.
##Input value:
##    int QuadPoint  --- node index, it can be from 0 to 6.
##    int *a.TrngleNode  ---  the three nodes of a tringular patch.
##    double *SrcPointCol --- where to store the results
##Return value: none
##Global value used: a.NodeCord, a.Qpnt
##Global value modified:    none
##Subroutines called:    none
##Note: Not very sure.
****************************************************************************
def ComputeGaussQuadPoint(QuadPoint,TrngleNode,a):

SrcPointCol=zeros((3),Float)

SrcPointCol[0] =   a.Qpnt[QuadPoint,0]*a.NodeCord[TrngleNode[0],0]\
+ a.Qpnt[QuadPoint,1]*a.NodeCord[TrngleNode[1],0]\
+ a.Qpnt[QuadPoint,2]*a.NodeCord[TrngleNode[2],0]

SrcPointCol[1] =   a.Qpnt[QuadPoint,0]*a.NodeCord[TrngleNode[0],1]\
+ a.Qpnt[QuadPoint,1]*a.NodeCord[TrngleNode[1],1]\
+ a.Qpnt[QuadPoint,2]*a.NodeCord[TrngleNode[2],1]

SrcPointCol[2] =   a.Qpnt[QuadPoint,0]*a.NodeCord[TrngleNode[0],2]\
+ a.Qpnt[QuadPoint,1]*a.NodeCord[TrngleNode[1],2]\
+ a.Qpnt[QuadPoint,2]*a.NodeCord[TrngleNode[2],2]

return SrcPointCol

--
The Numeric Python EM Project

www.members.home.net/europax

```

More information about the NumPy-Discussion mailing list