/[escript]/branches/domexper/dudley/src/CPPAdapter/MeshAdapter.cpp
ViewVC logotype

Diff of /branches/domexper/dudley/src/CPPAdapter/MeshAdapter.cpp

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

revision 148 by jgs, Tue Aug 23 01:24:31 2005 UTC revision 149 by jgs, Thu Sep 1 03:31:39 2005 UTC
# Line 28  extern "C" { Line 28  extern "C" {
28  #include "escript/Data/DataArrayView.h"  #include "escript/Data/DataArrayView.h"
29  #include "escript/Data/FunctionSpace.h"  #include "escript/Data/FunctionSpace.h"
30  #include "escript/Data/DataFactory.h"  #include "escript/Data/DataFactory.h"
31    
32  #include <iostream>  #include <iostream>
33  #include <vector>  #include <vector>
34  #include <sstream>  #include <sstream>
# Line 36  using namespace std; Line 37  using namespace std;
37  using namespace escript;  using namespace escript;
38    
39  namespace finley {  namespace finley {
40    
41  //  //
42  // define the statics  // define the static constants
43  MeshAdapter::FunctionSpaceNamesMapType MeshAdapter::m_functionSpaceTypeNames;  MeshAdapter::FunctionSpaceNamesMapType MeshAdapter::m_functionSpaceTypeNames;
44  const int MeshAdapter::DegreesOfFreedom=FINLEY_DEGREES_OF_FREEDOM;  const int MeshAdapter::DegreesOfFreedom=FINLEY_DEGREES_OF_FREEDOM;
45  const int MeshAdapter::ReducedDegreesOfFreedom=FINLEY_REDUCED_DEGREES_OF_FREEDOM;  const int MeshAdapter::ReducedDegreesOfFreedom=FINLEY_REDUCED_DEGREES_OF_FREEDOM;
# Line 56  MeshAdapter::MeshAdapter(Finley_Mesh* fi Line 58  MeshAdapter::MeshAdapter(Finley_Mesh* fi
58    // for us.    // for us.
59    m_finleyMesh.reset(finleyMesh,null_deleter());    m_finleyMesh.reset(finleyMesh,null_deleter());
60  }  }
61    
62  //  //
63  // The copy constructor should just increment the use count  // The copy constructor should just increment the use count
64  MeshAdapter::MeshAdapter(const MeshAdapter& in):  MeshAdapter::MeshAdapter(const MeshAdapter& in):
# Line 142  int MeshAdapter::getContinuousFunctionCo Line 145  int MeshAdapter::getContinuousFunctionCo
145  {  {
146    return Nodes;    return Nodes;
147  }  }
148    
149  int MeshAdapter::getFunctionCode() const  int MeshAdapter::getFunctionCode() const
150  {  {
151    return Elements;    return Elements;
152  }  }
153    
154  int MeshAdapter::getFunctionOnBoundaryCode() const  int MeshAdapter::getFunctionOnBoundaryCode() const
155  {  {
156    return FaceElements;    return FaceElements;
157  }  }
158    
159  int MeshAdapter::getFunctionOnContactZeroCode() const  int MeshAdapter::getFunctionOnContactZeroCode() const
160  {  {
161    return ContactElementsZero;    return ContactElementsZero;
162  }  }
163    
164  int MeshAdapter::getFunctionOnContactOneCode() const  int MeshAdapter::getFunctionOnContactOneCode() const
165  {  {
166    return ContactElementsOne;    return ContactElementsOne;
# Line 163  int MeshAdapter::getSolutionCode() const Line 170  int MeshAdapter::getSolutionCode() const
170  {  {
171    return DegreesOfFreedom;    return DegreesOfFreedom;
172  }  }
173    
174  int MeshAdapter::getReducedSolutionCode() const  int MeshAdapter::getReducedSolutionCode() const
175  {  {
176    return ReducedDegreesOfFreedom;    return ReducedDegreesOfFreedom;
177  }  }
178    
179  int MeshAdapter::getDiracDeltaFunctionCode() const  int MeshAdapter::getDiracDeltaFunctionCode() const
180  {  {
181    return Points;    return Points;
182  }  }
183    
184  //  //
185  // returns a pointer to the tag list of samples of functionSpaceType  // returns a pointer to the tag list of samples of functionSpaceType
186  //  //
# Line 243  void MeshAdapter::getTagList(int functio Line 253  void MeshAdapter::getTagList(int functio
253    }    }
254    return;    return;
255  }  }
256    
257  //  //
258  // returns a pointer to the reference no list of samples of functionSpaceType  // returns a pointer to the reference no list of samples of functionSpaceType
259  //  //
# Line 325  int MeshAdapter::getDim() const Line 336  int MeshAdapter::getDim() const
336    checkFinleyError();    checkFinleyError();
337    return numDim;    return numDim;
338  }  }
339    
340  //  //
341  // return the number of data points per sample and the number of samples  // return the number of data points per sample and the number of samples
342  // needed to represent data on a parts of the mesh.  // needed to represent data on a parts of the mesh.
# Line 390  pair<int,int> MeshAdapter::getDataShape( Line 402  pair<int,int> MeshAdapter::getDataShape(
402        }        }
403        return pair<int,int>(numDataPointsPerSample,numSamples);        return pair<int,int>(numDataPointsPerSample,numSamples);
404  }  }
405    
406  //  //
407  // adds linear PDE of second order into a given stiffness matrix and right hand side:  // adds linear PDE of second order into a given stiffness matrix and right hand side:
408  //  //
# Line 417  void MeshAdapter::addPDEToSystem( Line 430  void MeshAdapter::addPDEToSystem(
430                                    Finley_Assemble_handelShapeMissMatch_Step_out);                                    Finley_Assemble_handelShapeMissMatch_Step_out);
431     checkFinleyError();     checkFinleyError();
432  }  }
433    
434  //  //
435  // adds linear PDE of second order into the right hand side only  // adds linear PDE of second order into the right hand side only
436  //  //
# Line 437  void MeshAdapter::addPDEToRHS( Data& rhs Line 451  void MeshAdapter::addPDEToRHS( Data& rhs
451     // Finley_Assemble_RobinCondition_RHS(mesh->Nodes,mesh->ContactElements,&(rhs.getDataC()),&(y_contact.getDataC()),Finley_Assemble_handelShapeMissMatch_Step_out);     // Finley_Assemble_RobinCondition_RHS(mesh->Nodes,mesh->ContactElements,&(rhs.getDataC()),&(y_contact.getDataC()),Finley_Assemble_handelShapeMissMatch_Step_out);
452     checkFinleyError();     checkFinleyError();
453  }  }
454    
455  //  //
456  // interpolates data between different function spaces:  // interpolates data between different function spaces:
457  //  //
# Line 600  void MeshAdapter::setToX(Data& arg) cons Line 615  void MeshAdapter::setToX(Data& arg) cons
615    }    }
616    checkFinleyError();    checkFinleyError();
617  }  }
618    
619  //  //
620  // return the normal vectors at the location of data points as a Data object:  // return the normal vectors at the location of data points as a Data object:
621  //  //
# Line 644  void MeshAdapter::setToNormal(Data& norm Line 660  void MeshAdapter::setToNormal(Data& norm
660    }    }
661    checkFinleyError();    checkFinleyError();
662  }  }
663    
664  //  //
665  // interpolates data to other domain:  // interpolates data to other domain:
666  //  //
# Line 657  void MeshAdapter::interpolateACross(Data Line 674  void MeshAdapter::interpolateACross(Data
674    sprintf(Finley_ErrorMsg,"Finley does not allow interpolation across domains yet.");    sprintf(Finley_ErrorMsg,"Finley does not allow interpolation across domains yet.");
675    checkFinleyError();    checkFinleyError();
676  }  }
677    
678  //  //
679  // calculates the integral of a function defined of arg:  // calculates the integral of a function defined of arg:
680  //  //
# Line 703  void MeshAdapter::setToIntegrals(std::ve Line 721  void MeshAdapter::setToIntegrals(std::ve
721    }    }
722    checkFinleyError();    checkFinleyError();
723  }  }
724    
725  //  //
726  // calculates the gradient of arg:  // calculates the gradient of arg:
727  //  //
# Line 752  void MeshAdapter::setToGradient(Data& gr Line 771  void MeshAdapter::setToGradient(Data& gr
771    }    }
772    checkFinleyError();    checkFinleyError();
773  }  }
774    
775  //  //
776  // returns the size of elements:  // returns the size of elements:
777  //  //
# Line 793  void MeshAdapter::setToSize(Data& size) Line 813  void MeshAdapter::setToSize(Data& size)
813    }    }
814    checkFinleyError();    checkFinleyError();
815  }  }
816    
817  // sets the location of nodes:  // sets the location of nodes:
818  void MeshAdapter::setNewX(const Data& new_x)  void MeshAdapter::setNewX(const Data& new_x)
819  {  {
# Line 803  void MeshAdapter::setNewX(const Data& ne Line 824  void MeshAdapter::setNewX(const Data& ne
824    Finley_NodeFile_setCoordinates(mesh->Nodes,&(new_x.getDataC()));    Finley_NodeFile_setCoordinates(mesh->Nodes,&(new_x.getDataC()));
825    checkFinleyError();    checkFinleyError();
826  }  }
827    
828  // saves a data array in openDX format:  // saves a data array in openDX format:
829  void MeshAdapter::saveDX(const std::string& filename,const Data& arg) const  void MeshAdapter::saveDX(const std::string& filename,const Data& arg) const
830  {  {
831    Finley_Mesh_saveDX(filename.c_str(),m_finleyMesh.get(),&(arg.getDataC()));    Finley_Mesh_saveDX(filename.c_str(),m_finleyMesh.get(),&(arg.getDataC()));
832    checkFinleyError();    checkFinleyError();
833  }  }
834    
835  // saves a data array in openVTK format:  // saves a data array in openVTK format:
836  void MeshAdapter::saveVTK(const std::string& filename,const Data& arg) const  void MeshAdapter::saveVTK(const std::string& filename,const Data& arg) const
837  {  {
838    Finley_Mesh_saveVTK(filename.c_str(),m_finleyMesh.get(),&(arg.getDataC()));    Finley_Mesh_saveVTK(filename.c_str(),m_finleyMesh.get(),&(arg.getDataC()));
839    checkFinleyError();    checkFinleyError();
840  }  }
841    
842  // creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:  // creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:
843  SystemMatrixAdapter MeshAdapter::newSystemMatrix(  SystemMatrixAdapter MeshAdapter::newSystemMatrix(
844                        const int row_blocksize,                        const int row_blocksize,
# Line 856  SystemMatrixAdapter MeshAdapter::newSyst Line 880  SystemMatrixAdapter MeshAdapter::newSyst
880      Finley_SystemMatrixPattern_dealloc(fsystemMatrixPattern);      Finley_SystemMatrixPattern_dealloc(fsystemMatrixPattern);
881      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);
882  }  }
883    
884  //  //
885  // vtkObject MeshAdapter::createVtkObject() const  // vtkObject MeshAdapter::createVtkObject() const
886  // TODO:  // TODO:
887  //  //
888    
889  //  //
890  // returns true if data at the atom_type is considered as being cell centered:  // returns true if data at the atom_type is considered as being cell centered:
891  bool MeshAdapter::isCellOriented(int functionSpaceCode) const  bool MeshAdapter::isCellOriented(int functionSpaceCode) const
# Line 885  bool MeshAdapter::isCellOriented(int fun Line 911  bool MeshAdapter::isCellOriented(int fun
911    checkFinleyError();    checkFinleyError();
912    return false;    return false;
913  }  }
914    
915  bool MeshAdapter::probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const  bool MeshAdapter::probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const
916  {  {
917    switch(functionSpaceType_source) {    switch(functionSpaceType_source) {
# Line 970  bool MeshAdapter::probeInterpolationOnDo Line 997  bool MeshAdapter::probeInterpolationOnDo
997    checkFinleyError();    checkFinleyError();
998    return false;    return false;
999  }  }
1000    
1001  bool MeshAdapter::probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const  bool MeshAdapter::probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const
1002  {  {
1003      return false;      return false;
# Line 996  int MeshAdapter::getSystemMatrixTypeId(c Line 1024  int MeshAdapter::getSystemMatrixTypeId(c
1024     checkFinleyError();     checkFinleyError();
1025     return out;     return out;
1026  }  }
1027    
1028  Data MeshAdapter::getX() const  Data MeshAdapter::getX() const
1029  {  {
1030    return continuousFunction(asAbstractContinuousDomain()).getX();    return continuousFunction(asAbstractContinuousDomain()).getX();
1031  }  }
1032    
1033  Data MeshAdapter::getNormal() const  Data MeshAdapter::getNormal() const
1034  {  {
1035    return functionOnBoundary(asAbstractContinuousDomain()).getNormal();    return functionOnBoundary(asAbstractContinuousDomain()).getNormal();
1036  }  }
1037    
1038  Data MeshAdapter::getSize() const  Data MeshAdapter::getSize() const
1039  {  {
1040    return function(asAbstractContinuousDomain()).getSize();    return function(asAbstractContinuousDomain()).getSize();

Legend:
Removed from v.148  
changed lines
  Added in v.149

  ViewVC Help
Powered by ViewVC 1.1.26