*/
void InterpolationOptionsTest::test_InterpolationOptions() {
string sourcename=INTERP_TEST::getResourceFile("square1.med");
- MEDMEM::MESH source_mesh (MED_DRIVER,sourcename,"Mesh_2");
+ MEDMEM::MESH *source_mesh=new MEDMEM::MESH(MED_DRIVER,sourcename,"Mesh_2");
string targetname=INTERP_TEST::getResourceFile("square2.med");
- MEDMEM::MESH target_mesh (MED_DRIVER,targetname,"Mesh_3");
+ MEDMEM::MESH *target_mesh=new MEDMEM::MESH(MED_DRIVER,targetname,"Mesh_3");
- MEDMEM::SUPPORT source_support(&source_mesh,"on All support");
- MEDMEM::FIELD<double> source_field(&source_support,1);
- double* value=const_cast<double*>(source_field.getValue());
- for (int i=0; i<source_support.getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
+ MEDMEM::SUPPORT *source_support=new SUPPORT(source_mesh,"on All support");
+ MEDMEM::FIELD<double> *source_field=new FIELD<double>(source_support,1);
+ double* value=const_cast<double*>(source_field->getValue());
+ for (int i=0; i<source_support->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
value[i]=1.0;
-
- MEDMEM::SUPPORT target_support(&target_mesh,"on All support");
- MEDMEM::FIELD<double> target_field(&target_support,1);
- double* targetvalue=const_cast<double*>(target_field.getValue());
- for (int i=0; i<target_support.getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
+ source_support->removeReference();
+ MEDMEM::SUPPORT *target_support=new MEDMEM::SUPPORT(target_mesh,"on All support");
+ MEDMEM::FIELD<double> *target_field=new FIELD<double>(target_support,1);
+ double* targetvalue=const_cast<double*>(target_field->getValue());
+ for (int i=0; i<target_support->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
targetvalue[i]=0.0;
-
+ target_support->removeReference();
// Ok at this point we have our mesh in MED-Memory format.
// Go to wrap med_source_mesh and med_target_mesh.
- MEDNormalizedUnstructuredMesh<2,2> wrap_source_mesh(&source_mesh);
- MEDNormalizedUnstructuredMesh<2,2> wrap_target_mesh(&target_mesh);
+ MEDNormalizedUnstructuredMesh<2,2> wrap_source_mesh(source_mesh);
+ MEDNormalizedUnstructuredMesh<2,2> wrap_target_mesh(target_mesh);
// Go for interpolation...
INTERP_KERNEL::Interpolation2D myInterpolator;
//optionnal call to parametrize your interpolation. First precision, tracelevel, intersector wanted.
myInterpolator.setPrecision(1e-7);
myInterpolator.setPrintLevel(1);
+ source_mesh->removeReference();
+ source_field->removeReference();
+ target_field->removeReference();
+ target_mesh->removeReference();
}