From: eap Date: Fri, 5 Apr 2013 07:51:59 +0000 (+0000) Subject: 0021856: [CEA 663] Documenting API of MEDCoupling and MEDLoader X-Git-Tag: V6_main_FINAL~198 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=75ec1463dafd98606a8192990d450e7e48741d7a;p=tools%2Fmedcoupling.git 0021856: [CEA 663] Documenting API of MEDCoupling and MEDLoader MEDCouplingCMesh documented --- diff --git a/doc/doxygen/medcouplingexamples.doxy b/doc/doxygen/medcouplingexamples.doxy index be2bd77f9..ef07978cf 100644 --- a/doc/doxygen/medcouplingexamples.doxy +++ b/doc/doxygen/medcouplingexamples.doxy @@ -3,6 +3,24 @@ +\anchor cpp_mcumesh_ +

+ +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 +

Getting node coordinates

+ +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

Cells correspondence in two meshes

diff --git a/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx b/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx index a8e0ac3d2..28e0bec14 100644 --- a/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx +++ b/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx @@ -26,6 +26,19 @@ #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(); diff --git a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py index d5b59499d..4e5be8492 100644 --- a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py @@ -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();