def readFromHdf5(cls,
                  hdf5Parser,
                  varName,
                  triSurfaceMesh,
                  key,
                  projectedField=False):
     '''
     '''
     time = hdf5Parser[key]['time'].value
     stensSrc = hdf5Parser[key][varName].value
     stensTgt = np.zeros((stensSrc.shape[0],stensSrc.shape[1]))
     if projectedField==True:
         for i in range(stensSrc.shape[0]):
             stenAsMat = TriSurface.mat(stensSrc[i,:])
             stensTgt[i,:] = triSurfaceMesh.linTrans.srcToTgt(stenAsMat)
     else:
         stensTgt = stensSrc
     
     # update class member variables
     return cls(txx=stensTgt[:,0],
                txy=stensTgt[:,1],
                txz=stensTgt[:,2],
                tyy=stensTgt[:,3],
                tyz=stensTgt[:,4],
                tzz=stensTgt[:,5],
                time=float(time),
                triSurfaceMesh=triSurfaceMesh,
                projectedField=projectedField,
                interpolation=None,
                kind=None) 
    def readFromHdf5(cls,
                     hdf5Parser,
                     varName,
                     triSurfaceMesh,
                     key,
                     projectedField=False):
        '''
        '''
        time = hdf5Parser[key]['time'].value
        stensSrc = hdf5Parser[key][varName].value
        stensTgt = np.zeros((stensSrc.shape[0], stensSrc.shape[1]))
        if projectedField == True:
            for i in range(stensSrc.shape[0]):
                stenAsMat = TriSurface.mat(stensSrc[i, :])
                stensTgt[i, :] = triSurfaceMesh.linTrans.srcToTgt(stenAsMat)
        else:
            stensTgt = stensSrc

        # update class member variables
        return cls(txx=stensTgt[:, 0],
                   txy=stensTgt[:, 1],
                   txz=stensTgt[:, 2],
                   tyy=stensTgt[:, 3],
                   tyz=stensTgt[:, 4],
                   tzz=stensTgt[:, 5],
                   time=float(time),
                   triSurfaceMesh=triSurfaceMesh,
                   projectedField=projectedField,
                   interpolation=None,
                   kind=None)
    def readFromFoamFile(cls,
                         varsFile,
                         triSurfaceMesh,
                         time,
                         projectedField=False):
        '''
        Construct from a surface saved  by OpenFOAM in foamFile format.
        
        Arguments:
            *varsFile*: python string.
             Path to the file holding the scalar field.
             
            *time*: python float
             timestep of the surface. If this information does not matter,
             use 0.
             
            *triSurfaceMesh* :  TriSurfaceMesh object.
             TriSurfaceMesh object, which holds the mesh information.
             
            *projectedField* python bool (default=False)
             Unused for the scalar field, but might be used for the fields
             added with the methods "addField", "addFieldFromFoamFile" and
             "addFieldFromVtk"
        '''

        #get scalars
        stensSrc = ParserFunctions.parseFoamFile_sampledSurface(varsFile)
        stensTgt = np.zeros((stensSrc.shape[0],stensSrc.shape[1]))
        if projectedField==True:
            for i in range(stensSrc.shape[0]):
                stenAsMat = TriSurface.mat(stensSrc[i,:])
                stensTgt[i,:] = triSurfaceMesh.linTrans.srcToTgt(stenAsMat)
        else:
            stensTgt = stensSrc

        # update class member variables
        return cls(txx=stensTgt[:,0],
                   txy=stensTgt[:,1],
                   txz=stensTgt[:,2],
                   tyy=stensTgt[:,3],
                   tyz=stensTgt[:,4],
                   tzz=stensTgt[:,5],
                   time=time,
                   triSurfaceMesh=triSurfaceMesh,
                   projectedField=projectedField,
                   interpolation=None,
                   kind=None)
    def readFromFoamFile(cls,
                         varsFile,
                         triSurfaceMesh,
                         time,
                         projectedField=False):
        '''
        Construct from a surface saved  by OpenFOAM in foamFile format.
        
        Arguments:
            *varsFile*: python string.
             Path to the file holding the scalar field.
             
            *time*: python float
             timestep of the surface. If this information does not matter,
             use 0.
             
            *triSurfaceMesh* :  TriSurfaceMesh object.
             TriSurfaceMesh object, which holds the mesh information.
             
            *projectedField* python bool (default=False)
             Unused for the scalar field, but might be used for the fields
             added with the methods "addField", "addFieldFromFoamFile" and
             "addFieldFromVtk"
        '''

        #get scalars
        stensSrc = ParserFunctions.parseFoamFile_sampledSurface(varsFile)
        stensTgt = np.zeros((stensSrc.shape[0], stensSrc.shape[1]))
        if projectedField == True:
            for i in range(stensSrc.shape[0]):
                stenAsMat = TriSurface.mat(stensSrc[i, :])
                stensTgt[i, :] = triSurfaceMesh.linTrans.srcToTgt(stenAsMat)
        else:
            stensTgt = stensSrc

        # update class member variables
        return cls(txx=stensTgt[:, 0],
                   txy=stensTgt[:, 1],
                   txz=stensTgt[:, 2],
                   tyy=stensTgt[:, 3],
                   tyz=stensTgt[:, 4],
                   tzz=stensTgt[:, 5],
                   time=time,
                   triSurfaceMesh=triSurfaceMesh,
                   projectedField=projectedField,
                   interpolation=None,
                   kind=None)