/[escript]/trunk/finley/src/CPPAdapter/MeshAdapter.cpp
ViewVC logotype

Diff of /trunk/finley/src/CPPAdapter/MeshAdapter.cpp

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

revision 1859 by gross, Wed Oct 8 03:03:37 2008 UTC revision 1872 by jfenwick, Mon Oct 13 00:18:55 2008 UTC
# Line 860  void MeshAdapter::addPDEToTransportProbl Line 860  void MeshAdapter::addPDEToTransportProbl
860  //  //
861  void MeshAdapter::interpolateOnDomain(escript::Data& target,const escript::Data& in) const  void MeshAdapter::interpolateOnDomain(escript::Data& target,const escript::Data& in) const
862  {  {
863     const MeshAdapter& inDomain=dynamic_cast<const MeshAdapter&>(in.getFunctionSpace().getDomain());     const MeshAdapter& inDomain=dynamic_cast<const MeshAdapter&>(*(in.getFunctionSpace().getDomain()));
864     const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(target.getFunctionSpace().getDomain());     const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(*(target.getFunctionSpace().getDomain()));
865     if (inDomain!=*this)       if (inDomain!=*this)  
866        throw FinleyAdapterException("Error - Illegal domain of interpolant.");        throw FinleyAdapterException("Error - Illegal domain of interpolant.");
867     if (targetDomain!=*this)     if (targetDomain!=*this)
# Line 1145  void MeshAdapter::interpolateOnDomain(es Line 1145  void MeshAdapter::interpolateOnDomain(es
1145  //  //
1146  void MeshAdapter::setToX(escript::Data& arg) const  void MeshAdapter::setToX(escript::Data& arg) const
1147  {  {
1148     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(*(arg.getFunctionSpace().getDomain()));
1149     if (argDomain!=*this)     if (argDomain!=*this)
1150        throw FinleyAdapterException("Error - Illegal domain of data point locations");        throw FinleyAdapterException("Error - Illegal domain of data point locations");
1151     Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
# Line 1168  void MeshAdapter::setToX(escript::Data& Line 1168  void MeshAdapter::setToX(escript::Data&
1168  //  //
1169  void MeshAdapter::setToNormal(escript::Data& normal) const  void MeshAdapter::setToNormal(escript::Data& normal) const
1170  {  {
1171     const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(normal.getFunctionSpace().getDomain());  /*   const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(normal.getFunctionSpace().getDomain());*/
1172       const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(*(normal.getFunctionSpace().getDomain()));
1173     if (normalDomain!=*this)     if (normalDomain!=*this)
1174        throw FinleyAdapterException("Error - Illegal domain of normal locations");        throw FinleyAdapterException("Error - Illegal domain of normal locations");
1175     Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
# Line 1223  void MeshAdapter::setToNormal(escript::D Line 1224  void MeshAdapter::setToNormal(escript::D
1224  //  //
1225  void MeshAdapter::interpolateACross(escript::Data& target,const escript::Data& source) const  void MeshAdapter::interpolateACross(escript::Data& target,const escript::Data& source) const
1226  {  {
1227     const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(target.getFunctionSpace().getDomain());     const MeshAdapter& targetDomain=dynamic_cast<const MeshAdapter&>(*(target.getFunctionSpace().getDomain()));
1228     if (targetDomain!=*this)     if (targetDomain!=*this)
1229        throw FinleyAdapterException("Error - Illegal domain of interpolation target");        throw FinleyAdapterException("Error - Illegal domain of interpolation target");
1230    
# Line 1235  void MeshAdapter::interpolateACross(escr Line 1236  void MeshAdapter::interpolateACross(escr
1236  //  //
1237  void MeshAdapter::setToIntegrals(std::vector<double>& integrals,const escript::Data& arg) const  void MeshAdapter::setToIntegrals(std::vector<double>& integrals,const escript::Data& arg) const
1238  {  {
1239     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(*(arg.getFunctionSpace().getDomain()));
1240     if (argDomain!=*this)     if (argDomain!=*this)
1241        throw FinleyAdapterException("Error - Illegal domain of integration kernel");        throw FinleyAdapterException("Error - Illegal domain of integration kernel");
1242    
# Line 1246  void MeshAdapter::setToIntegrals(std::ve Line 1247  void MeshAdapter::setToIntegrals(std::ve
1247     escriptDataC _arg=arg.getDataC();     escriptDataC _arg=arg.getDataC();
1248     switch(arg.getFunctionSpace().getTypeCode()) {     switch(arg.getFunctionSpace().getTypeCode()) {
1249     case(Nodes):     case(Nodes):
1250     temp=escript::Data( arg, function(asAbstractContinuousDomain()) );     temp=escript::Data( arg, escript::function(asAbstractContinuousDomain()) );
1251     _temp=temp.getDataC();     _temp=temp.getDataC();
1252     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1253     break;     break;
1254     case(ReducedNodes):     case(ReducedNodes):
1255     temp=escript::Data( arg, function(asAbstractContinuousDomain()) );     temp=escript::Data( arg, escript::function(asAbstractContinuousDomain()) );
1256     _temp=temp.getDataC();     _temp=temp.getDataC();
1257     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1258     break;     break;
# Line 1283  void MeshAdapter::setToIntegrals(std::ve Line 1284  void MeshAdapter::setToIntegrals(std::ve
1284     Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->ContactElements,&_arg,&integrals[0]);
1285     break;     break;
1286     case(DegreesOfFreedom):     case(DegreesOfFreedom):
1287     temp=escript::Data( arg, function(asAbstractContinuousDomain()) );     temp=escript::Data( arg, escript::function(asAbstractContinuousDomain()) );
1288     _temp=temp.getDataC();     _temp=temp.getDataC();
1289     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1290     break;     break;
1291     case(ReducedDegreesOfFreedom):     case(ReducedDegreesOfFreedom):
1292     temp=escript::Data( arg, function(asAbstractContinuousDomain()) );     temp=escript::Data( arg, escript::function(asAbstractContinuousDomain()) );
1293     _temp=temp.getDataC();     _temp=temp.getDataC();
1294     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);     Finley_Assemble_integrate(mesh->Nodes,mesh->Elements,&_temp,&integrals[0]);
1295     break;     break;
# Line 1307  void MeshAdapter::setToIntegrals(std::ve Line 1308  void MeshAdapter::setToIntegrals(std::ve
1308  //  //
1309  void MeshAdapter::setToGradient(escript::Data& grad,const escript::Data& arg) const  void MeshAdapter::setToGradient(escript::Data& grad,const escript::Data& arg) const
1310  {  {
1311     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(arg.getFunctionSpace().getDomain());     const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(*(arg.getFunctionSpace().getDomain()));
1312     if (argDomain!=*this)     if (argDomain!=*this)
1313        throw FinleyAdapterException("Error - Illegal domain of gradient argument");        throw FinleyAdapterException("Error - Illegal domain of gradient argument");
1314     const MeshAdapter& gradDomain=dynamic_cast<const MeshAdapter&>(grad.getFunctionSpace().getDomain());     const MeshAdapter& gradDomain=dynamic_cast<const MeshAdapter&>(*(grad.getFunctionSpace().getDomain()));
1315     if (gradDomain!=*this)     if (gradDomain!=*this)
1316        throw FinleyAdapterException("Error - Illegal domain of gradient");        throw FinleyAdapterException("Error - Illegal domain of gradient");
1317    
# Line 1437  void MeshAdapter::setNewX(const escript: Line 1438  void MeshAdapter::setNewX(const escript:
1438  {  {
1439     Finley_Mesh* mesh=m_finleyMesh.get();     Finley_Mesh* mesh=m_finleyMesh.get();
1440     escriptDataC tmp;     escriptDataC tmp;
1441     const MeshAdapter& newDomain=dynamic_cast<const MeshAdapter&>(new_x.getFunctionSpace().getDomain());     const MeshAdapter& newDomain=dynamic_cast<const MeshAdapter&>(*(new_x.getFunctionSpace().getDomain()));
1442     if (newDomain!=*this)     if (newDomain!=*this)
1443        throw FinleyAdapterException("Error - Illegal domain of new point locations");        throw FinleyAdapterException("Error - Illegal domain of new point locations");
1444     tmp = new_x.getDataC();     tmp = new_x.getDataC();
# Line 1464  void MeshAdapter::saveDX(const std::stri Line 1465  void MeshAdapter::saveDX(const std::stri
1465     for (int i=0;i<num_data;++i) {     for (int i=0;i<num_data;++i) {
1466        std::string n=boost::python::extract<std::string>(keys[i]);        std::string n=boost::python::extract<std::string>(keys[i]);
1467        escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);        escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);
1468        if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)        if (dynamic_cast<const MeshAdapter&>(*(d.getFunctionSpace().getDomain())) !=*this)
1469           throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");           throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
1470        data[i]=d.getDataC();        data[i]=d.getDataC();
1471        ptr_data[i]= &(data[i]);        ptr_data[i]= &(data[i]);
# Line 1509  void MeshAdapter::saveVTK(const std::str Line 1510  void MeshAdapter::saveVTK(const std::str
1510     for (int i=0;i<num_data;++i) {     for (int i=0;i<num_data;++i) {
1511        std::string n=boost::python::extract<std::string>(keys[i]);        std::string n=boost::python::extract<std::string>(keys[i]);
1512        escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);        escript::Data& d=boost::python::extract<escript::Data&>(arg[keys[i]]);
1513        if (dynamic_cast<const MeshAdapter&>(d.getFunctionSpace().getDomain()) !=*this)        if (dynamic_cast<const MeshAdapter&>(*(d.getFunctionSpace().getDomain())) !=*this)
1514           throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");           throw FinleyAdapterException("Error  in saveVTK: Data must be defined on same Domain");
1515        data[i]=d.getDataC();        data[i]=d.getDataC();
1516        ptr_data[i]=&(data[i]);        ptr_data[i]=&(data[i]);
# Line 1547  SystemMatrixAdapter MeshAdapter::newSyst Line 1548  SystemMatrixAdapter MeshAdapter::newSyst
1548     int reduceRowOrder=0;     int reduceRowOrder=0;
1549     int reduceColOrder=0;     int reduceColOrder=0;
1550     // is the domain right?     // is the domain right?
1551     const MeshAdapter& row_domain=dynamic_cast<const MeshAdapter&>(row_functionspace.getDomain());     const MeshAdapter& row_domain=dynamic_cast<const MeshAdapter&>(*(row_functionspace.getDomain()));
1552     if (row_domain!=*this)     if (row_domain!=*this)
1553        throw FinleyAdapterException("Error - domain of row function space does not match the domain of matrix generator.");        throw FinleyAdapterException("Error - domain of row function space does not match the domain of matrix generator.");
1554     const MeshAdapter& col_domain=dynamic_cast<const MeshAdapter&>(column_functionspace.getDomain());     const MeshAdapter& col_domain=dynamic_cast<const MeshAdapter&>(*(column_functionspace.getDomain()));
1555     if (col_domain!=*this)     if (col_domain!=*this)
1556        throw FinleyAdapterException("Error - domain of columnn function space does not match the domain of matrix generator.");        throw FinleyAdapterException("Error - domain of columnn function space does not match the domain of matrix generator.");
1557     // is the function space type right     // is the function space type right
# Line 1595  TransportProblemAdapter MeshAdapter::new Line 1596  TransportProblemAdapter MeshAdapter::new
1596  {  {
1597     int reduceOrder=0;     int reduceOrder=0;
1598     // is the domain right?     // is the domain right?
1599     const MeshAdapter& domain=dynamic_cast<const MeshAdapter&>(functionspace.getDomain());     const MeshAdapter& domain=dynamic_cast<const MeshAdapter&>(*(functionspace.getDomain()));
1600     if (domain!=*this)     if (domain!=*this)
1601        throw FinleyAdapterException("Error - domain of function space does not match the domain of transport problem generator.");        throw FinleyAdapterException("Error - domain of function space does not match the domain of transport problem generator.");
1602     // is the function space type right     // is the function space type right
# Line 1851  escript::Data MeshAdapter::getNormal() c Line 1852  escript::Data MeshAdapter::getNormal() c
1852    
1853  escript::Data MeshAdapter::getSize() const  escript::Data MeshAdapter::getSize() const
1854  {  {
1855     return function(asAbstractContinuousDomain()).getSize();     return escript::function(asAbstractContinuousDomain()).getSize();
1856  }  }
1857    
1858  int* MeshAdapter::borrowSampleReferenceIDs(int functionSpaceType) const  int* MeshAdapter::borrowSampleReferenceIDs(int functionSpaceType) const

Legend:
Removed from v.1859  
changed lines
  Added in v.1872

  ViewVC Help
Powered by ViewVC 1.1.26