]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
0021856: [CEA 663] Documenting API of MEDCoupling and MEDLoader
authoreap <eap@opencascade.com>
Fri, 5 Apr 2013 07:51:59 +0000 (07:51 +0000)
committereap <eap@opencascade.com>
Fri, 5 Apr 2013 07:51:59 +0000 (07:51 +0000)
   MEDCouplingCMesh documented

doc/doxygen/medcouplingexamples.doxy
src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx
src/MEDCoupling_Swig/MEDCouplingExamplesTest.py

index be2bd77f9db9ab8ef93ae7decc8509a41cc03973..ef07978cfce7d395c98dac857f65443711435b74 100644 (file)
@@ -3,6 +3,24 @@
 
 
 
+\anchor cpp_mcumesh_
+<br><h2>  </h2>
+
+First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
+\snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_
+\snippet MEDCouplingExamplesTest.py PySnippet_MEDCouplingUMesh_
+\snippet MEDCouplingExamplesTest.py Snippet_MEDCouplingUMesh_
+
+
+\anchor cpp_mccmesh_getCoordsAt
+<br><h2> Getting node coordinates </h2>
+
+We create an 1D Cartesian mesh and retrieves node coordinates using
+\ref ParaMEDMEM::MEDCouplingCMesh::getCoordsAt "getCoordsAt()".
+\snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingCMesh_getCoordsAt_1
+
+
+
 \anchor cpp_mcumesh_areCellsIncludedIn
 <br><h2> Cells correspondence in two meshes </h2>
 
index a8e0ac3d23da013d50b749e01485fb539b4419ed..28e0bec14d5992a6436f753cb415b7f66aebd6e8 100644 (file)
 #include "MEDCouplingMemArray.hxx"
 #include "MEDCouplingMultiFields.hxx"
 
+void CppExample_MEDCouplingPointSet_getCoordsAt()
+{
+  using namespace ParaMEDMEM;
+  //! [CppSnippet_MEDCouplingCMesh_getCoordsAt_1]
+  const double coords[3] = {1.,2.,4.};
+  DataArrayDouble* x = DataArrayDouble::New();
+  x->useExternalArrayWithRWAccess( coords, 3, 1 );
+  MEDCouplingCMesh *mesh=MEDCouplingCMesh::New();
+  mesh->setCoordsAt(0,x);
+  const DataArrayDouble* x2=mesh->getCoordsAt(0);
+  CPPUNIT_ASSERT( x2->isEqual( *x, 1e-13 ));
+  //! [CppSnippet_MEDCouplingCMesh_getCoordsAt_1]
+}
 
 void CppExample_MEDCouplingUMesh_areCellsIncludedIn()
 {
@@ -1806,6 +1819,7 @@ void CppSnippetFieldDoubleBuild4()
 
 int main(int argc, char *argv[])
 {
+  CppExample_MEDCouplingPointSet_getCoordsAt();
   CppExample_MEDCouplingUMesh_areCellsIncludedIn();
   CppExample_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells();
   CppExample_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented();
index d5b59499d784ec51bf18e73b59479987db37bedc..4e5be8492b332aa1d40bd7eead75e543425453de 100644 (file)
@@ -27,6 +27,17 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         #! [PySnippet_MEDCouplingUMesh__1]
         return
 
+    def testExample_MEDCouplingCMesh_getCoordsAt(self):
+        #! [PySnippet_MEDCouplingCMesh_getCoordsAt_1]
+        coords = [1.,2.,4.]
+        x=DataArrayDouble.New(coords,3,1)
+        mesh=MEDCouplingCMesh.New()
+        mesh.setCoordsAt(0,x)
+        x2=mesh.getCoordsAt(0)
+        assert coords == x2.getValues()
+        #! [PySnippet_MEDCouplingCMesh_getCoordsAt_1]
+        return
+
     def testExample_MEDCouplingUMesh_areCellsIncludedIn(self):
         #! [PySnippet_MEDCouplingUMesh_areCellsIncludedIn_1]
         mesh1=MEDCouplingUMesh.New();