def writeFEPOINT(self, stream):
        """writes out a new FEPOINT file with the given name, using the supplied points.
        derivs is of size (3,len(points),len(control_points)), giving matricies of
        X,Y,Z drivatives

        jacobian should have a shape of (len(points),len(control_points))"""

        self.provideJ()

        lines = ['TITLE = "FFD_geom"',]
        var_line = 'VARIABLES = "X" "Y" "Z" "ID" '


        deriv_X_names = []
        deriv_R_names = []
        deriv_T_names = []

        deriv_tmpl = string.Template('"dx_d${name}_${type}$i" "dy_d${name}_${type}$i" "dz_d${name}_${type}$i"')

        for comp in self._comps:
            if isinstance(comp,Body):
                deriv_X_names.extend([deriv_tmpl.substitute({'name':comp.name,'i':str(i),'type':'X'}) for i in xrange(0,comp.n_controls)]) #x,y,z derivs for each control point
                deriv_R_names.extend([deriv_tmpl.substitute({'name':comp.name,'i':str(i),'type':'R'}) for i in xrange(0,comp.n_controls)]) #x,y,z derivs for each control point

            else:
                deriv_X_names.extend([deriv_tmpl.substitute({'name':comp.name,'i':str(i),'type':'X'}) for i in xrange(0,comp.n_c_controls)]) #x,y,z derivs for each control point
                deriv_R_names.extend([deriv_tmpl.substitute({'name':comp.name,'i':str(i),'type':'R'}) for i in xrange(0,comp.n_c_controls)]) #x,y,z derivs for each control point
                deriv_T_names.extend([deriv_tmpl.substitute({'name':comp.name,'i':str(i),'type':'T'}) for i in xrange(0,comp.n_t_controls)]) #x,y,z derivs for each control point

        var_line += " ".join(deriv_X_names)
        var_line += " ".join(deriv_R_names)
        var_line += " ".join(deriv_T_names)

        lines.append(var_line)

        lines.append('ZONE T = group0, I = %d, J = %d, F=FEPOINT'%(self.n_points,self.n_triangles)) #TODO I think this J number depends on the number of variables

        #xyz for each parameter
        nx = 3*self.dXqdC.shape[1]
        nr = 3*self.dYqdCr.shape[1]
        nt = 3*self.dYqdCt.shape[1]
        j_cols =  (nx+nr+nt)


        for i,p in enumerate(self.points):
            line = "%.8f %.8f %.8f %d "%(p[0],p[1],p[2],i+1) #x,y,z,index coordiantes of point

            #deriv_values = self.J[i]
            deriv_values = np.zeros((j_cols,))
            deriv_values[:nx:3] = self.dXqdC[i]

            #leave x as zero
            deriv_values[nx+1:nx+nr:3] = self.dYqdCr[i]
            deriv_values[nx+2:nx+nr:3] = self.dZqdCr[i]

            #leave x as zero
            deriv_values[nx+nr+1::3] = self.dYqdCt[i]
            deriv_values[nx+nr+2::3] = self.dZqdCt[i]

            line += " ".join(np.char.mod('%.8f',deriv_values))
            lines.append(line)

        for tri in self.triangles:
            line = "%d %d %d %d"%(tri[0]+1,tri[1]+1,tri[2]+1,tri[2]+1) #tecplot wants 1 bias indecies
            lines.append(line)


        needs_close = False
        if isinstance(stream, basestring):
            stream = open(stream,'w')
            needs_close = True

        #f.write("\n".join(lines))
        #f.close()

        print >> stream, "\n".join(lines)
        if(needs_close):
            stream.close()
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/geometry/stl_group.py/STLGroup.writeFEPOINT/original