Exemple #1
0
 def eval(self, prob):
     if prob._formulation == 'HJ':
         inds = closestPoints(prob.mesh, self.loc)
         q = np.zeros(prob.mesh.nC)
         q[inds] = self.current * np.r_[1.]
     elif prob._formulation == 'EB':
         q = prob.mesh.getInterpolationMat(self.loc, locType='N').todense()
         q = self.current * mkvc(q)
     return q
Exemple #2
0
 def eval(self, prob):
     if prob._formulation == 'HJ':
         inds = closestPoints(prob.mesh, self.loc)
         q = np.zeros(prob.mesh.nC)
         q[inds] = self.current * np.r_[1.]
     elif prob._formulation == 'EB':
         q = prob.mesh.getInterpolationMat(self.loc, locType='N').todense()
         q = self.current * mkvc(q)
     return q
Exemple #3
0
 def eval(self, prob):
     if prob._formulation == 'HJ':
         inds = closestPoints(prob.mesh, self.loc, gridLoc='CC')
         q = np.zeros(prob.mesh.nC)
         q[inds] = self.current * np.r_[1., -1.]
     elif prob._formulation == 'EB':
         qa = prob.mesh.getInterpolationMat(self.loc[0], locType='N').todense()
         qb = -prob.mesh.getInterpolationMat(self.loc[1], locType='N').todense()
         q = self.current * mkvc(qa+qb)
     return q
Exemple #4
0
 def eval(self, prob):
     if prob._formulation == 'HJ':
         inds = closestPoints(prob.mesh, self.loc, gridLoc='CC')
         q = np.zeros(prob.mesh.nC)
         q[inds] = self.current * np.r_[1., -1.]
     elif prob._formulation == 'EB':
         qa = prob.mesh.getInterpolationMat(self.loc[0],
                                            locType='N').todense()
         qb = -prob.mesh.getInterpolationMat(self.loc[1],
                                             locType='N').todense()
         q = self.current * mkvc(qa + qb)
     return q
Exemple #5
0
 def eval(self, prob):
     if self._q is not None:
         return self._q
     else:
         if prob._formulation == 'HJ':
             inds = closestPoints(prob.mesh, self.loc)
             self._q = np.zeros(prob.mesh.nC)
             self._q[inds] = self.current * np.r_[1.]
         elif prob._formulation == 'EB':
             q = prob.mesh.getInterpolationMat(
                 self.loc, locType='N'
             )
             self._q = self.current * q.toarray()
         return self._q
Exemple #6
0
 def eval(self, prob):
     if self._q is not None:
         return self._q
     else:
         if prob._formulation == 'HJ':
             inds = closestPoints(prob.mesh, self.loc, gridLoc='CC')
             self._q = np.zeros(prob.mesh.nC)
             self._q[inds] = self.current * np.r_[1., -1.]
         elif prob._formulation == 'EB':
             qa = prob.mesh.getInterpolationMat(self.loc[0],
                                                locType='N').toarray()
             qb = -prob.mesh.getInterpolationMat(self.loc[1],
                                                 locType='N').toarray()
             self._q = self.current * (qa+qb)
         return self._q