/[escript]/trunk/escript/src/AbstractTransportProblem.cpp
ViewVC logotype

Diff of /trunk/escript/src/AbstractTransportProblem.cpp

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

revision 1407 by gross, Mon Feb 4 06:45:48 2008 UTC revision 1417 by gross, Mon Feb 25 04:45:48 2008 UTC
# Line 16  Line 16 
16  #include "TransportProblemException.h"  #include "TransportProblemException.h"
17  #include "DataArrayView.h"  #include "DataArrayView.h"
18  #include "Data.h"  #include "Data.h"
19    #include <iostream>
20    
21    
22  namespace escript {  namespace escript {
23    
# Line 66  void AbstractTransportProblem::setInitia Line 68  void AbstractTransportProblem::setInitia
68  {  {
69       if (isEmpty())       if (isEmpty())
70            throw TransportProblemException("Error - transport problem is empty.");            throw TransportProblemException("Error - transport problem is empty.");
71       if (u.getFunctionSpace()!=getFunctionSpace())       if (u.isEmpty())
72            throw TransportProblemException("Error - function space of transport problem and function space of initial value do not match.");            throw TransportProblemException("Error - empty initial value.");
73    
74         if ((getBlockSize()==1) and (u.getDataPointRank()>0) or (u.getDataPointRank()>1))
75              throw TransportProblemException("Error - illegal rank of initial value.");
76    
77       if (u.getDataPointSize()!=getBlockSize())       if (u.getDataPointSize()!=getBlockSize())
78            throw TransportProblemException("Error - block size of transport problem and initial value source do not match.");            throw TransportProblemException("Error - block size of transport problem and initial value do not match.");
79       copyInitialValue(u);  
80         Data u2=Data(u,getFunctionSpace());
81         copyInitialValue(u2);
82    }
83    void AbstractTransportProblem::insertConstraint(Data& source, Data& q, Data& r) const
84    {
85         source.expand();
86         if (isEmpty())
87              throw TransportProblemException("Error - transport problem is empty.");
88         if (q.isEmpty()) {
89              return;
90         }
91         if ((getBlockSize()==1) and (q.getDataPointRank()>0) or (q.getDataPointRank()>1))
92              throw TransportProblemException("Error - illegal rank of constraint location.");
93         if (q.getDataPointSize()!=getBlockSize())
94              throw TransportProblemException("Error - block size of transport problem and constraint location don't match.");
95         Data q2=Data(q,getFunctionSpace());
96    
97         if (r.isEmpty()) {
98              Data r2=Data(0.,q.getDataPointShape(),getFunctionSpace());
99              copyConstraint(source,q2,r2);
100         } else {
101            if ((getBlockSize()==1) and (r.getDataPointRank()>0) or (r.getDataPointRank()>1))
102                 throw TransportProblemException("Error - illegal rank of constraint value.");
103            if (r.getDataPointSize()!=getBlockSize())
104                 throw TransportProblemException("Error - block size of transport problem and constraint value don't match.");
105            Data r2=Data(r,getFunctionSpace());
106            copyConstraint(source,q2,r2);
107         }
108  }  }
109    
110    void AbstractTransportProblem::copyConstraint(Data& source, Data& q, Data& r) const
111    {
112        throw TransportProblemException("Error - copyConstraint is not available");
113    }
114  void AbstractTransportProblem::copyInitialValue(Data& u) const  void AbstractTransportProblem::copyInitialValue(Data& u) const
115  {  {
116      throw TransportProblemException("Error - copyInitialValue is not available");      throw TransportProblemException("Error - copyInitialValue is not available");

Legend:
Removed from v.1407  
changed lines
  Added in v.1417

  ViewVC Help
Powered by ViewVC 1.1.26