/[escript]/branches/symbolic_from_3470/pasowrap/src/TransportProblemAdapter.cpp
ViewVC logotype

Diff of /branches/symbolic_from_3470/pasowrap/src/TransportProblemAdapter.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3867 by caltinay, Thu Feb 9 00:27:46 2012 UTC revision 3868 by caltinay, Thu Mar 15 06:07:08 2012 UTC
# Line 96  void TransportProblemAdapter::resetTrans Line 96  void TransportProblemAdapter::resetTrans
96  }  }
97    
98  PASOWRAP_DLL_API  PASOWRAP_DLL_API
99  void TransportProblemAdapter::copyConstraint(escript::Data& source, escript::Data& q, escript::Data& r, const double factor) const  void TransportProblemAdapter::copyConstraint(escript::Data& source, escript::Data& q, escript::Data& r) const
100  {  {
101      if ( q.getDataPointSize()  != getBlockSize()) {      if ( q.getDataPointSize()  != getBlockSize()) {
102       throw PasoException("copyConstraint : block size does not match the number of components of constraint mask.");       throw PasoException("copyConstraint : block size does not match the number of components of constraint mask.");
# Line 113  void TransportProblemAdapter::copyConstr Line 113  void TransportProblemAdapter::copyConstr
113      }      }
114      Paso_TransportProblem* transp=getPaso_TransportProblem();      Paso_TransportProblem* transp=getPaso_TransportProblem();
115    
     /* r2=r where q>0, 0 elsewhere */  
     escript::Data r2(0.,q.getDataPointShape(),q.getFunctionSpace());  
     r2.copyWithMask(r,q);  
   
     /* source-=transp->mass_matrix*r2 */  
     r2.expand();  
     source.expand();  
     q.expand();  
     r2.requireWrite();  
     source.requireWrite();  
     q.requireWrite();  
     double* r2_dp=r2.getSampleDataRW(0);  
     double* source_dp=source.getSampleDataRW(0);  
     double* q_dp=q.getSampleDataRW(0);  
116    
117      if (false) {      if (false) {
118          
119          /* r2=r where q>0, 0 elsewhere */
120          escript::Data r2(0.,q.getDataPointShape(),q.getFunctionSpace());
121          r2.copyWithMask(r,q);
122    
123          /* source-=transp->mass_matrix*r2 */
124          r2.expand();
125          source.expand();
126          q.expand();
127          r2.requireWrite();
128          source.requireWrite();
129          q.requireWrite();
130          double* r2_dp=r2.getSampleDataRW(0);
131          double* source_dp=source.getSampleDataRW(0);
132          double* q_dp=q.getSampleDataRW(0);
133        
134         cout << "v1\n";         cout << "v1\n";
135         Paso_SystemMatrix_MatrixVector(-1., transp->mass_matrix, r2_dp, 1., source_dp);         Paso_SystemMatrix_MatrixVector(-1., transp->mass_matrix, r2_dp, 1., source_dp);
136         checkPasoError();         checkPasoError();
# Line 143  void TransportProblemAdapter::copyConstr Line 145  void TransportProblemAdapter::copyConstr
145    
146         source.copyWithMask(escript::Data(0.,q.getDataPointShape(),q.getFunctionSpace()),q);         source.copyWithMask(escript::Data(0.,q.getDataPointShape(),q.getFunctionSpace()),q);
147     } else {     } else {
148         Paso_TransportProblem_setUpConstraint(transp, q_dp, factor);         r.expand();
149           source.expand();
150           q.expand();
151           r.requireWrite();
152           source.requireWrite();
153           q.requireWrite();
154           double* r_dp=r.getSampleDataRW(0);
155           double* source_dp=source.getSampleDataRW(0);
156           double* q_dp=q.getSampleDataRW(0);
157           Paso_TransportProblem_setUpConstraint(transp, q_dp);
158         checkPasoError();         checkPasoError();
159         Paso_TransportProblem_insertConstraint(transp,r2_dp, source_dp);         Paso_TransportProblem_insertConstraint(transp,r_dp, source_dp);
160         checkPasoError();         checkPasoError();
161     }     }
162  }  }

Legend:
Removed from v.3867  
changed lines
  Added in v.3868

  ViewVC Help
Powered by ViewVC 1.1.26