From: michael Date: Fri, 10 Dec 2021 13:24:36 +0000 (+0100) Subject: Testing the use of field profile. MEDCoupling generates an error X-Git-Tag: V9_8_0~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5f023378c03c450779f235ac2716a5f201801ef6;p=tools%2Fsolverlab.git Testing the use of field profile. MEDCoupling generates an error --- diff --git a/CDMATH/tests/cdmath/CMakeLists.txt b/CDMATH/tests/cdmath/CMakeLists.txt index 070ea66..62aa8a0 100755 --- a/CDMATH/tests/cdmath/CMakeLists.txt +++ b/CDMATH/tests/cdmath/CMakeLists.txt @@ -1,5 +1,6 @@ INCLUDE_DIRECTORIES( ${CPPUNIT_INCLUDE_DIR} + ${MEDFILE_INCLUDE_DIRS} ${MEDCOUPLING_INCLUDE_DIR} ${MESH_DIR}/inc ${BASE_DIR}/inc diff --git a/CDMATH/tests/cdmath/FieldTests.cxx b/CDMATH/tests/cdmath/FieldTests.cxx old mode 100644 new mode 100755 index ce09706..fef87d3 --- a/CDMATH/tests/cdmath/FieldTests.cxx +++ b/CDMATH/tests/cdmath/FieldTests.cxx @@ -10,6 +10,9 @@ #include #include +#include +#include +#include "MEDFileMesh.hxx" using namespace std; using namespace MEDCoupling; @@ -236,4 +239,169 @@ FieldTests::testClassField( void ) CPPUNIT_ASSERT_EQUAL( 1, concF1.getNumberOfComponents() ); CPPUNIT_ASSERT_EQUAL( 0.0, concF1.getTime() ); CPPUNIT_ASSERT_EQUAL( 24, concF1.getNumberOfElements() ); + + Mesh M2(0.,1.,2,0.,1.,2,1); + Field concF2("CONCENTRATION",CELLS,M2) ; + for (int j=0;j (3,1),"CONSTANT_Field"); + CPPUNIT_ASSERT_EQUAL( 3, concF5.getNumberOfComponents() ); + CPPUNIT_ASSERT_EQUAL( 0., concF5.getTime() ); + CPPUNIT_ASSERT_EQUAL( 66, concF5.getNumberOfElements() ); + for (int j=0;jbuildUnstructured(); + //m1->setName("mesh"); + + //MEDCouplingFieldDouble * f = MEDCouplingFieldDouble::New(ON_CELLS, ONE_TIME); + //f->setMesh(m1); + //f->setName("F"); + //*f=0; + //f->setTime(0.0,0,0); + + //MEDFileField1TS * ff; + //ff->setFieldNoProfileSBT(f); + + /* 1D image mesh */ + //int _spaceDim=1; + //double *originPtr = new double[_spaceDim]; + //double *dxyzPtr = new double[_spaceDim]; + //mcIdType *nodeStrctPtr = new mcIdType[_spaceDim]; + + //originPtr[0]=0; + //nodeStrctPtr[0]=3; + //dxyzPtr[0]=1; + + //MEDCouplingIMesh * _mesh=MEDCouplingIMesh::New("test", + //_spaceDim, + //nodeStrctPtr, + //nodeStrctPtr+_spaceDim, + //originPtr, + //originPtr+_spaceDim, + //dxyzPtr, + //dxyzPtr+_spaceDim); + //MEDCouplingUMesh * m1 = _mesh->buildUnstructured(); + //m1->setName("mesh"); + + //MEDCouplingFieldDouble * f = MEDCouplingFieldDouble::New(ON_CELLS, ONE_TIME); + //f->setMesh(m1); + //f->setName("F"); + //*f=0; + //f->setTime(0.0,0,0); + + //MEDFileField1TS * ff; + //ff->setFieldNoProfileSBT(f); + + /* 2D cartesian mesh */ + //Dataarray + double XCoords[3]={0.,1.,2.}; + double YCoords[3]={0.,1.,2.}; + MEDCoupling::DataArrayDouble *arrX=MEDCoupling::DataArrayDouble::New(); + arrX->alloc(3,1); + std::copy(XCoords,XCoords+3,arrX->getPointer()); + arrX->setInfoOnComponent(0,"X [m]"); + MEDCoupling::DataArrayDouble *arrY=MEDCoupling::DataArrayDouble::New(); + arrY->alloc(3,1); + std::copy(YCoords,YCoords+3,arrY->getPointer()); + arrY->setInfoOnComponent(0,"Y [m]"); + //Mesh + MEDCoupling::MEDCouplingCMesh *mesh=MEDCoupling::MEDCouplingCMesh::New("My2D_CMesh"); + mesh->setCoords(arrX,arrY); + arrX->decrRef(); + arrY->decrRef(); + MEDCouplingUMesh * m1 = mesh->buildUnstructured(); + m1->setName("mesh"); + //Field + MEDCouplingFieldDouble * f = MEDCouplingFieldDouble::New(ON_CELLS, ONE_TIME); + f->setMesh(m1); + f->setName("F"); + *f=0; + f->setTime(0.0,0,0); + //MEDFileField1TS + MEDFileField1TS * ff; + //ff->setFieldNoProfileSBT(f); }