pygeo/parameterization/DVGeo.py
def updatePyGeo(self, geo, outputType, fileName, nRefU=0, nRefV=0):
        """Deform a pyGeo object and write to a file of specified type
        given the (deformed) current state of the FFD object.

        Parameters
        ----------
        geo : pyGeo object
            A pyGeo object containing an initialized object
        outputType: str
            Type of output file to be written. Can be `iges` or `tecplot`
        fileName: str
            Filename for the output file. Should have no extension, an
            extension will be added
        nRefU: int or list of ints
            Number of spline refinement points to add in the surface B-Spline u-direction.
            If scalar, it is applied across each surface. If list, the length must match the
            number of surfaces in the object and corresponding entries are matched with surfaces.
        nRefV: int or list of ints
            Number of spline refinement points to add in the surface B-Spline v-direction.
            If scalar, it is applied across each surface. If list, the length must match the
            number of surfaces in the object and corresponding entries are matched with surfaces
        """
        # Function to check if value matches a knot point
        # (set to 1e-12 to match pySpline mult. tolerance)
        def check_mult(val, knots):
            for iKnot in range(len(knots)):
                if np.isclose(val, knots[iKnot], atol=1e-12):
                    return True
            return False

        # Refine Surface -- U-Direction
        if isinstance(nRefU, int):
            # Refine BSplines by adding knot points
            Refine_U = np.linspace(0.0, 1.0, nRefU + 2)
            for iSurf in range(geo.nSurf):
                for iX in Refine_U:
                    if not check_mult(iX, geo.surfs[iSurf].tu):
                        geo.surfs[iSurf].insertKnot("u", iX, 1)
        elif isinstance(nRefU, list):
            if len(nRefU) != geo.nSurf:
                raise RuntimeError("Length of nRefU does not match number of surfaces in object")
            # Refine BSplines by adding knot points
            for iSurf in range(geo.nSurf):
                Refine_U = np.linspace(0.0, 1.0, nRefU[iSurf] + 2)
                for iX in Refine_U:
                    if not check_mult(iX, geo.surfs[iSurf].tu):
                        geo.surfs[iSurf].insertKnot("u", iX, 1)
        else:
            raise TypeError("nRefU type not recognized, must be: integer or list of integers")

        # Refine Surface -- V-Direction
        if isinstance(nRefV, int):
            # Refine BSplines by adding knot points
            Refine_V = np.linspace(0.0, 1.0, nRefV + 2)
            for iSurf in range(geo.nSurf):
                for iY in Refine_V:
                    if not check_mult(iY, geo.surfs[iSurf].tv):
                        geo.surfs[iSurf].insertKnot("v", iY, 1)
        elif isinstance(nRefV, list):
            if len(nRefU) != geo.nSurf:
                raise RuntimeError("Length of nRefV does not match number of surfaces in object")
            # Refine BSplines by adding knot points
            for iSurf in range(geo.nSurf):
                Refine_V = np.linspace(0.0, 1.0, nRefV[iSurf] + 2)
                for iY in Refine_V:
                    if not check_mult(iY, geo.surfs[iSurf].tv):
                        geo.surfs[iSurf].insertKnot("v", iY, 1)
        else:
            raise TypeError("nRefV type not recognized, must be: integer or list of integers")

        # Update Coefficients
        for iSurf in range(geo.nSurf):
            # Add Point Sets
            npt = geo.surfs[iSurf].nCtlu * geo.surfs[iSurf].nCtlv
            self.addPointSet(geo.surfs[iSurf].coef.reshape((npt, 3)), "coef%d" % iSurf)

            # Update and Overwrite Old Values
            geo.surfs[iSurf].coef = self.update("coef%d" % iSurf).reshape(geo.surfs[iSurf].coef.shape)

        # Write File
        if outputType == "iges":
            geo.writeIGES(fileName + ".igs")
        elif outputType == "tecplot":
            geo.writeTecplot(fileName + ".plt")
        else:
            raise ValueError(f"Type {outputType} not recognized. Must be either 'iges' or 'tecplot'")
Deform a pyGeo object and write to a file of specified type
        given the (deformed) current state of the FFD object.

        Parameters
        ----------
        geo : pyGeo object
            A pyGeo object containing an initialized object
        outputType: str
            Type of output file to be written. Can be `iges` or `tecplot`
        fileName: str
            Filename for the output file. Should have no extension, an
            extension will be added
        nRefU: int or list of ints
            Number of spline refinement points to add in the surface B-Spline u-direction.
            If scalar, it is applied across each surface. If list, the length must match the
            number of surfaces in the object and corresponding entries are matched with surfaces.
        nRefV: int or list of ints
            Number of spline refinement points to add in the surface B-Spline v-direction.
            If scalar, it is applied across each surface. If list, the length must match the
            number of surfaces in the object and corresponding entries are matched with surfaces
        
Deform a pyGeo object and write to a file of specified type
given the (deformed) current state of the FFD object.

Parameters

geo : pyGeo object
A pyGeo object containing an initialized object
outputType: str
Type of output file to be written. Can be `iges` or `tecplot`
fileName: str
Filename for the output file. Should have no extension, an
extension will be added
nRefU: int or list of ints
Number of spline refinement points to add in the surface B-Spline u-direction.
If scalar, it is applied across each surface. If list, the length must match the
number of surfaces in the object and corresponding entries are matched with surfaces.
nRefV: int or list of ints
Number of spline refinement points to add in the surface B-Spline v-direction.
If scalar, it is applied across each surface. If list, the length must match the
number of surfaces in the object and corresponding entries are matched with surfaces
Deform a pyGeo object and write to a file of specified type given the ( deformed ) current state of the FFD object . Parameters geo : pyGeo object A pyGeo object containing an initialized object outputType : str Type of output file to be written . Can be ` iges ` or ` tecplot ` fileName : str Filename for the output file . Should have no extension an extension will be added nRefU : int or list of ints Number of spline refinement points to add in the surface B - Spline u - direction . If scalar it is applied across each surface . If list the length must match the number of surfaces in the object and corresponding entries are matched with surfaces . nRefV : int or list of ints Number of spline refinement points to add in the surface B - Spline v - direction . If scalar it is applied across each surface . If list the length must match the number of surfaces in the object and corresponding entries are matched with surfaces
def updatePyGeo(self, geo, outputType, fileName, nRefU=0, nRefV=0):
        def check_mult(val, knots):
            for iKnot in range(len(knots)):
                if np.isclose(val, knots[iKnot], atol=1e-12):
                    return True
            return False
        if isinstance(nRefU, int):
            Refine_U = np.linspace(0.0, 1.0, nRefU + 2)
            for iSurf in range(geo.nSurf):
                for iX in Refine_U:
                    if not check_mult(iX, geo.surfs[iSurf].tu):
                        geo.surfs[iSurf].insertKnot("u", iX, 1)
        elif isinstance(nRefU, list):
            if len(nRefU) != geo.nSurf:
                raise RuntimeError("Length of nRefU does not match number of surfaces in object")
            for iSurf in range(geo.nSurf):
                Refine_U = np.linspace(0.0, 1.0, nRefU[iSurf] + 2)
                for iX in Refine_U:
                    if not check_mult(iX, geo.surfs[iSurf].tu):
                        geo.surfs[iSurf].insertKnot("u", iX, 1)
        else:
            raise TypeError("nRefU type not recognized, must be: integer or list of integers")
        if isinstance(nRefV, int):
            Refine_V = np.linspace(0.0, 1.0, nRefV + 2)
            for iSurf in range(geo.nSurf):
                for iY in Refine_V:
                    if not check_mult(iY, geo.surfs[iSurf].tv):
                        geo.surfs[iSurf].insertKnot("v", iY, 1)
        elif isinstance(nRefV, list):
            if len(nRefU) != geo.nSurf:
                raise RuntimeError("Length of nRefV does not match number of surfaces in object")
            for iSurf in range(geo.nSurf):
                Refine_V = np.linspace(0.0, 1.0, nRefV[iSurf] + 2)
                for iY in Refine_V:
                    if not check_mult(iY, geo.surfs[iSurf].tv):
                        geo.surfs[iSurf].insertKnot("v", iY, 1)
        else:
            raise TypeError("nRefV type not recognized, must be: integer or list of integers")
        for iSurf in range(geo.nSurf):
            npt = geo.surfs[iSurf].nCtlu * geo.surfs[iSurf].nCtlv
            self.addPointSet(geo.surfs[iSurf].coef.reshape((npt, 3)), "coef%d" % iSurf)
            geo.surfs[iSurf].coef = self.update("coef%d" % iSurf).reshape(geo.surfs[iSurf].coef.shape)
        if outputType == "iges":
            geo.writeIGES(fileName + ".igs")
        elif outputType == "tecplot":
            geo.writeTecplot(fileName + ".plt")
        else:
            raise ValueError(f"Type {outputType} not recognized. Must be either 'iges' or 'tecplot'")
def updatePyGeo ( self , geo , outputType , fileName , nRefU = 0 , nRefV = 0 ) : def check_mult ( val , knots ) : for iKnot in range ( len ( knots ) ) : if np . isclose ( val , knots [ iKnot ] , atol = 1e-12 ) : return True return False if isinstance ( nRefU , int ) : Refine_U = np . linspace ( 0.0 , 1.0 , nRefU + 2 ) for iSurf in range ( geo . nSurf ) : for iX in Refine_U : if not check_mult ( iX , geo . surfs [ iSurf ] . tu ) : geo . surfs [ iSurf ] . insertKnot ( "u" , iX , 1 ) elif isinstance ( nRefU , list ) : if len ( nRefU ) != geo . nSurf : raise RuntimeError ( "Length of nRefU does not match number of surfaces in object" ) for iSurf in range ( geo . nSurf ) : Refine_U = np . linspace ( 0.0 , 1.0 , nRefU [ iSurf ] + 2 ) for iX in Refine_U : if not check_mult ( iX , geo . surfs [ iSurf ] . tu ) : geo . surfs [ iSurf ] . insertKnot ( "u" , iX , 1 ) else : raise TypeError ( "nRefU type not recognized, must be: integer or list of integers" ) if isinstance ( nRefV , int ) : Refine_V = np . linspace ( 0.0 , 1.0 , nRefV + 2 ) for iSurf in range ( geo . nSurf ) : for iY in Refine_V : if not check_mult ( iY , geo . surfs [ iSurf ] . tv ) : geo . surfs [ iSurf ] . insertKnot ( "v" , iY , 1 ) elif isinstance ( nRefV , list ) : if len ( nRefU ) != geo . nSurf : raise RuntimeError ( "Length of nRefV does not match number of surfaces in object" ) for iSurf in range ( geo . nSurf ) : Refine_V = np . linspace ( 0.0 , 1.0 , nRefV [ iSurf ] + 2 ) for iY in Refine_V : if not check_mult ( iY , geo . surfs [ iSurf ] . tv ) : geo . surfs [ iSurf ] . insertKnot ( "v" , iY , 1 ) else : raise TypeError ( "nRefV type not recognized, must be: integer or list of integers" ) for iSurf in range ( geo . nSurf ) : npt = geo . surfs [ iSurf ] . nCtlu * geo . surfs [ iSurf ] . nCtlv self . addPointSet ( geo . surfs [ iSurf ] . coef . reshape ( ( npt , 3 ) ) , "coef%d" % iSurf ) geo . surfs [ iSurf ] . coef = self . update ( "coef%d" % iSurf ) . reshape ( geo . surfs [ iSurf ] . coef . shape ) if outputType == "iges" : geo . writeIGES ( fileName + ".igs" ) elif outputType == "tecplot" : geo . writeTecplot ( fileName + ".plt" ) else : raise ValueError ( f"Type {outputType} not recognized. Must be either 'iges' or 'tecplot'" )
Deform a pyGeo object and write to a file of specified type
given the (deformed) current state of the FFD object.
Deform a pyGeo object and write to a file of specified type given the ( deformed ) current state of the FFD object .
"""Deform a pyGeo object and write to a file of specified type
        given the (deformed) current state of the FFD object.

        Parameters
        ----------
        geo : pyGeo object
            A pyGeo object containing an initialized object
        outputType: str
            Type of output file to be written. Can be `iges` or `tecplot`
        fileName: str
            Filename for the output file. Should have no extension, an
            extension will be added
        nRefU: int or list of ints
            Number of spline refinement points to add in the surface B-Spline u-direction.
            If scalar, it is applied across each surface. If list, the length must match the
            number of surfaces in the object and corresponding entries are matched with surfaces.
        nRefV: int or list of ints
            Number of spline refinement points to add in the surface B-Spline v-direction.
            If scalar, it is applied across each surface. If list, the length must match the
            number of surfaces in the object and corresponding entries are matched with surfaces
        """ # Function to check if value matches a knot point # (set to 1e-12 to match pySpline mult. tolerance) # Refine Surface -- U-Direction # Refine BSplines by adding knot points # Refine BSplines by adding knot points # Refine Surface -- V-Direction # Refine BSplines by adding knot points # Refine BSplines by adding knot points # Update Coefficients # Add Point Sets # Update and Overwrite Old Values # Write File
self
geo
outputType
fileName
nRefU
nRefV