def METHOD_NAME(fname,xp,yp,ccdata,ncdata):
    outfile=open(fname,'w')
    Npx=xp.shape[1]
    Npy=xp.shape[0]
    zero=0
    one=1
    outfile.write("<?xml version=\"1.0\"?>\n")
    outfile.write("<VTKFile type=\"StructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n")
    outfile.write("<StructuredGrid WholeExtent=\"%d %d %d %d %d %d\">\n"%(one,Npx,one,Npy,one,one))
    #piece extent is useful when writing in parallel
    #it corresponds to extents for each processor in global coordinates, eg: 1-2 is proc 0, 3-4 is proc 0
    outfile.write("<Piece Extent=\"%d %d %d %d %d %d\">\n"%(one,Npx,one,Npy,one,one))
    outfile.write("<PointData>\n")
    n_ncdata=ncdata.shape[0]
    if(n_ncdata > 0):
        for ndataset in range(n_ncdata):
            outfile.write("<DataArray type=\"Float32\" Name=\"node_data%d\" format=\"ascii\">\n"%(ndataset))
            for i in range(ncdata.shape[1]):
                outfile.write("%e\t"%(ncdata[ndataset][i]))
            outfile.write("\n</DataArray>\n")
    outfile.write("</PointData>\n")
    outfile.write("<CellData>\n")
    n_ccdata=ccdata.shape[0]
    if(n_ccdata > 0):
        for ndataset in range(n_ccdata):
            outfile.write("<DataArray type=\"Float32\" Name=\"cell_data%d\" format=\"ascii\">\n"%(ndataset))
            for i in range(ccdata.shape[1]):
                outfile.write("%e\t"%(ccdata[ndataset][i]))
            outfile.write("\n</DataArray>\n")
    outfile.write("</CellData>\n")
    outfile.write("<Points>\n")
    outfile.write("<DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n")
    for j in range(Npy):
        for i in range(Npx):
            outfile.write("%e\t%e\t%e\t"%(xp[j][i],yp[j][i],zero))
    outfile.write("\n</DataArray>\n")
    outfile.write("</Points>\n")
    outfile.write("</Piece>\n")
    outfile.write("</StructuredGrid>\n")
    outfile.write("</VTKFile>")