-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field2 =
field1->cloneWithMesh( true );
double vec[1] = { 5. };
- ((ParaMEDMEM::MEDCouplingMesh *)field2->getMesh())->translate(vec); // translate mesh2
+ (const_cast<ParaMEDMEM::MEDCouplingMesh *>(field2->getMesh()))->translate(vec); // translate mesh2
field2->applyFunc("x + 5"); // "translate" field2
// concatenate field1 and field2
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field =
MEDCouplingFieldDouble::New( ParaMEDMEM::ON_CELLS );
field->setArray( array );
- const char func[] = "IVec * v + JVec * v*v + 10";
- field->applyFunc( func );
+ const char func[] = "IVec * v + JVec * w*w + 10";
+ field->applyFunc( 2, func );
CPPUNIT_ASSERT( field->getNumberOfComponents() == 2 ); // 2 components remains
//! [CppSnippet_MEDCouplingFieldDouble_applyFunc_same_nb_comp_1]
//! [CppSnippet_MEDCouplingFieldDouble_applyFunc_same_nb_comp_2]
field->renumberNodes(renumber,false);
const MEDCouplingMesh* mesh2 = field->getMesh(); // field now refers to another mesh
values = field->getArray();
- nodeCoords = ((MEDCouplingUMesh*)mesh2)->getCoords();
+ nodeCoords = (static_cast<const MEDCouplingUMesh*>(mesh2))->getCoords();
CPPUNIT_ASSERT( values->isEqualWithoutConsideringStr( *nodeCoords, 1e-13 ));
//! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_3]
}
0.3, 0.3, // point located somewhere inside the mesh
coords[2], coords[3]}; // point at the node #1
const double eps = 1e-4; // ball radius
- std::vector<int> cells, cellsIndex;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cells, cellsIndex;
mesh->getCellsContainingPoints( pos, 3, eps, cells, cellsIndex );
const int cellsExpected[3]={4, 0, 1};
const int cellsIndexExpected[4]={0, 0, 1, 3};
- CPPUNIT_ASSERT(std::equal( cellsExpected, cellsExpected+3, &cells[0]));
- CPPUNIT_ASSERT(std::equal( cellsIndexExpected, cellsIndexExpected+4, &cellsIndex[0]));
+ CPPUNIT_ASSERT(std::equal( cellsExpected, cellsExpected+3, cells->begin()));
+ CPPUNIT_ASSERT(std::equal( cellsIndexExpected, cellsIndexExpected+4, cellsIndex->begin()));
//! [CppSnippet_MEDCouplingUMesh_getCellsContainingPoints_2]
}