def interpolation_CTPSC2B(self): meshCTPSC2B = np.ones((self.arrM.BoudBef.shape[0], self.arrM.BoudBef.shape[0])) xcoor = self.arrM.BoudBef[:, 0] ycoor = self.arrM.BoudBef[:, 1] xcoorT = np.transpose(xcoor) ycoorT = np.transpose(ycoor) distSqX = np.square(xcoor[:, np.newaxis]-xcoorT) distSqY = np.square(ycoor[:, np.newaxis]-ycoorT) distSq = distSqX+distSqY distSqCompactCTPS = np.sqrt(distSq)/self.radiusCTPS localindexCTPS = distSqCompactCTPS <= 1 ##Local index for CTPS Series nonzerobou = distSq != 0 localFinal = np.logical_and(nonzerobou, localindexCTPS) ##For RBF with local support only CTPS Funct_IntCompactCTPS = fun(distSq[localFinal], self.radiusCTPS) meshCTPSC2B[localFinal] = Funct_IntCompactCTPS.CTPSC2B() CoorCTPSC2B = np.ones((self.Coor.shape[0], self.arrM.BoudBef.shape[0])) CoorAllX = self.Coor[:, 1] CoorAllY = self.Coor[:, 2] distNdX = np.square(CoorAllX[:, np.newaxis]-xcoorT) distNdY = np.square(CoorAllY[:, np.newaxis]-ycoorT) distNd = distNdX+distNdY nonzeroindx = distNd != 0 distNdCompactCTPS = np.sqrt(distNd)/self.radiusCTPS localoutCTPS = distNdCompactCTPS <= 1 localoutFinal = np.logical_and(nonzeroindx, localoutCTPS) ##for RBF with local support only for CTPS FunctOutCompactCTPS = fun(distNd[localoutFinal], self.radius) CoorCTPSC2B[localoutFinal] = FunctOutCompactCTPS.CTPSC2B() meshCal_CTPSC2B = Matrix_Cal.Cal(self.dim, self.disp, self.Coor, self.arrM, meshCTPSC2B, CoorCTPSC2B) self.meshManipCTPSC2B = np.add(self.Coor[:, 1: self.dim+1], meshCal_CTPSC2B) self.MeshQuCTPSC2B = Quality(self.arrM, self.meshManipCTPSC2B)
def interpolation_CPC2(self): meshCPCsq = np.zeros((self.arrM.BoudBef.shape[0], self.arrM.BoudBef.shape[0])) xcoor = self.arrM.BoudBef[:, 0] ycoor = self.arrM.BoudBef[:, 1] xcoorT = np.transpose(xcoor) ycoorT = np.transpose(ycoor) distSqX = np.square(xcoor[:, np.newaxis]-xcoorT) distSqY = np.square(ycoor[:, np.newaxis]-ycoorT) distSq = distSqX+distSqY distSqCompact = np.sqrt(distSq)/self.radius ##Local index localindex = distSqCompact <= 1 Funct_IntCompact = fun(distSq[localindex], self.radius) meshCPCsq[localindex] = Funct_IntCompact.CPCsq() CoorCPCsq = np.zeros((self.Coor.shape[0], self.arrM.BoudBef.shape[0])) CoorAllX = self.Coor[:, 1] CoorAllY = self.Coor[:, 2] distNdX = np.square(CoorAllX[:, np.newaxis]-xcoorT) distNdY = np.square(CoorAllY[:, np.newaxis]-ycoorT) distNd = distNdX+distNdY distNdCompact = np.sqrt(distNd)/self.radius localout = distNdCompact <= 1 FunctOutCompact = fun(distNd[localout], self.radius) CoorCPCsq[localout] = FunctOutCompact.CPCsq() meshCal_CPCsq = Matrix_Cal.Cal(self.dim, self.disp, self.Coor, self.arrM, meshCPCsq, CoorCPCsq) self.meshManipCPCsq = np.add(self.Coor[:, 1: self.dim+1], meshCal_CPCsq) self.MeshQuCPC2 = Quality(self.arrM, self.meshManipCPCsq)
def interpolation_TPS(self): CoorTPS = np.zeros((self.Coor.shape[0], self.arrM.BoudBef.shape[0])) meshTPS = np.zeros((self.arrM.BoudBef.shape[0], self.arrM.BoudBef.shape[0])) xcoor = self.arrM.BoudBef[:, 0] ycoor = self.arrM.BoudBef[:, 1] xcoorT = np.transpose(xcoor) ycoorT = np.transpose(ycoor) distSqX = np.square(xcoor[:, np.newaxis]-xcoorT) distSqY = np.square(ycoor[:, np.newaxis]-ycoorT) distSq = distSqX+distSqY ##TPS index nonzerobou = distSq != 0 Funct_Int = fun(distSq[nonzerobou], self.radius) meshTPS[nonzerobou] = Funct_Int.TPS() CoorAllX = self.Coor[:, 1] CoorAllY = self.Coor[:, 2] distNdX = np.square(CoorAllX[:, np.newaxis]-xcoorT) distNdY = np.square(CoorAllY[:, np.newaxis]-ycoorT) distNd = distNdX+distNdY nonzeroindx = distNd != 0 FunctOut = fun(distNd[nonzeroindx], self.radius) CoorTPS[nonzeroindx] = FunctOut.TPS() meshCal_TPS = Matrix_Cal.Cal(self.dim, self.disp, self.Coor, self.arrM, meshTPS, CoorTPS) self.meshManipTPS = np.add(self.Coor[:, 1: self.dim+1], meshCal_TPS) self.MeshQuTPS = Quality(self.arrM, self.meshManipTPS)
def interpolation_CPC4(self): meshCPC4 = np.zeros((self.arrM.BoudBef.shape[0], self.arrM.BoudBef.shape[0])) #To calculate the interpolants for mesh generations, and apply the obtained #interpolatns to all the nodes in the meshes, and calculate the new coordinates xcoor = self.arrM.BoudBef[:, 0] ycoor = self.arrM.BoudBef[:, 1] xcoorT = np.transpose(xcoor) ycoorT = np.transpose(ycoor) distSqX = np.square(xcoor[:, np.newaxis]-xcoorT) distSqY = np.square(ycoor[:, np.newaxis]-ycoorT) distSq = distSqX+distSqY distSqCompact = np.sqrt(distSq)/self.radius ##Local index localindex = distSqCompact <= 1 Funct_IntCompact = fun(distSq[localindex], self.radius) meshCPC4[localindex] = Funct_IntCompact.CPC4() CoorCPC4 = np.zeros((self.Coor.shape[0], self.arrM.BoudBef.shape[0])) CoorAllX = self.Coor[:, 1] CoorAllY = self.Coor[:, 2] distNdX = np.square(CoorAllX[:, np.newaxis]-xcoorT) distNdY = np.square(CoorAllY[:, np.newaxis]-ycoorT) distNd = distNdX+distNdY distNdCompact = np.sqrt(distNd)/self.radius localout = distNdCompact <= 1 FunctOutCompact = fun(distNd[localout], self.radius) CoorCPC4[localout] = FunctOutCompact.CPC4() meshCal_CPC4 = Matrix_Cal.Cal(self.dim, self.disp, self.Coor, self.arrM, meshCPC4, CoorCPC4) self.meshManipCPC4 = np.add(self.Coor[:, 1: self.dim+1], meshCal_CPC4) self.MeshQuCPC4 = Quality(self.arrM, self.meshManipCPC4)
def interpolation_CPC6(self): meshCPC6 = np.zeros((self.arrM.BoudBef.shape[0], self.arrM.BoudBef.shape[0])) #To calculate the interpolants for mesh generations, and apply the obtained #interpolatns to all the nodes in the meshes, and calculate the new coordinates xcoor = self.arrM.BoudBef[:, 0] ycoor = self.arrM.BoudBef[:, 1] xcoorT = np.transpose(xcoor) ycoorT = np.transpose(ycoor) distSqX = np.square(xcoor[:, np.newaxis]-xcoorT) distSqY = np.square(ycoor[:, np.newaxis]-ycoorT) distSq = distSqX+distSqY distSqCompact = np.sqrt(distSq)/self.radius nonzerobou = distSq != 0 ##Local index localindex = distSqCompact <= 1 Funct_IntCompact = fun(distSq[localindex], self.radius) meshCPC6[localindex] = Funct_IntCompact.CPC6() CoorCPC6 = np.zeros((self.Coor.shape[0], self.arrM.BoudBef.shape[0])) CoorAllX = self.Coor[:, 1] CoorAllY = self.Coor[:, 2] distNdX = np.square(CoorAllX[:, np.newaxis]-xcoorT) distNdY = np.square(CoorAllY[:, np.newaxis]-ycoorT) distNd = distNdX+distNdY distNdCompact = np.sqrt(distNd)/self.radius #To find nonzero terms, then using Broadcast to modify all the elements #By broadcast function, the for loops are replaced nonzeroindx = distNd != 0 localout = distNdCompact <= 1 ##for RBF with local suppor except CTPS FunctOutCompact = fun(distNd[localout], self.radius) CoorCPC6[localout] = FunctOutCompact.CPC6() meshCal_CPC6 = Matrix_Cal.Cal(self.dim, self.disp, self.Coor, self.arrM, meshCPC6, CoorCPC6) self.meshManipCPC6 = np.add(self.Coor[:, 1: self.dim+1], meshCal_CPC6) self.MeshQuCPC6 = Quality(self.arrM, self.meshManipCPC6)