1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingUMesh.hxx"
29 #include "MEDCouplingExtrudedMesh.hxx"
30 #include "MEDCouplingCMesh.hxx"
31 #include "MEDCouplingCurveLinearMesh.hxx"
32 #include "MEDCoupling1GTUMesh.hxx"
33 #include "MEDCouplingField.hxx"
34 #include "MEDCouplingFieldDouble.hxx"
35 #include "MEDCouplingFieldTemplate.hxx"
36 #include "MEDCouplingGaussLocalization.hxx"
37 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
38 #include "MEDCouplingMultiFields.hxx"
39 #include "MEDCouplingFieldOverTime.hxx"
40 #include "MEDCouplingDefinitionTime.hxx"
41 #include "MEDCouplingFieldDiscretization.hxx"
42 #include "MEDCouplingTypemaps.i"
44 #include "InterpKernelAutoPtr.hxx"
46 using namespace ParaMEDMEM;
47 using namespace INTERP_KERNEL;
51 %template(ivec) std::vector<int>;
52 %template(dvec) std::vector<double>;
53 %template(svec) std::vector<std::string>;
56 %typemap(out) ParaMEDMEM::MEDCouplingMesh*
58 $result=convertMesh($1,$owner);
61 %typemap(out) MEDCouplingMesh*
63 $result=convertMesh($1,$owner);
68 %typemap(out) ParaMEDMEM::MEDCouplingPointSet*
70 $result=convertMesh($1,$owner);
73 %typemap(out) MEDCouplingPointSet*
75 $result=convertMesh($1,$owner);
81 %typemap(out) ParaMEDMEM::MEDCoupling1GTUMesh*
83 $result=convertMesh($1,$owner);
86 %typemap(out) MEDCoupling1GTUMesh*
88 $result=convertMesh($1,$owner);
93 %typemap(out) ParaMEDMEM::MEDCouplingStructuredMesh*
95 $result=convertMesh($1,$owner);
98 %typemap(out) MEDCouplingStructuredMesh*
100 $result=convertMesh($1,$owner);
105 %typemap(out) ParaMEDMEM::MEDCouplingFieldDiscretization*
107 $result=convertFieldDiscretization($1,$owner);
110 %typemap(out) MEDCouplingFieldDiscretization*
112 $result=convertFieldDiscretization($1,$owner);
117 %typemap(out) ParaMEDMEM::MEDCouplingMultiFields*
119 $result=convertMultiFields($1,$owner);
122 %typemap(out) MEDCouplingMultiFields*
124 $result=convertMultiFields($1,$owner);
129 %init %{ import_array(); %}
132 %feature("autodoc", "1");
133 %feature("docstring");
135 %newobject ParaMEDMEM::MEDCouplingField::buildMeasureField;
136 %newobject ParaMEDMEM::MEDCouplingField::getLocalizationOfDiscr;
137 %newobject ParaMEDMEM::MEDCouplingField::computeTupleIdsToSelectFromCellIds;
138 %newobject ParaMEDMEM::MEDCouplingFieldDouble::New;
139 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getArray;
140 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getEndArray;
141 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MergeFields;
142 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MeldFields;
143 %newobject ParaMEDMEM::MEDCouplingFieldDouble::doublyContractedProduct;
144 %newobject ParaMEDMEM::MEDCouplingFieldDouble::determinant;
145 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenValues;
146 %newobject ParaMEDMEM::MEDCouplingFieldDouble::eigenVectors;
147 %newobject ParaMEDMEM::MEDCouplingFieldDouble::inverse;
148 %newobject ParaMEDMEM::MEDCouplingFieldDouble::trace;
149 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
150 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
151 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
152 %newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
153 %newobject ParaMEDMEM::MEDCouplingFieldDouble::extractSlice3D;
154 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DotFields;
155 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
156 %newobject ParaMEDMEM::MEDCouplingFieldDouble::CrossProductFields;
157 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProduct;
158 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MaxFields;
159 %newobject ParaMEDMEM::MEDCouplingFieldDouble::max;
160 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MinFields;
161 %newobject ParaMEDMEM::MEDCouplingFieldDouble::AddFields;
162 %newobject ParaMEDMEM::MEDCouplingFieldDouble::SubstractFields;
163 %newobject ParaMEDMEM::MEDCouplingFieldDouble::MultiplyFields;
164 %newobject ParaMEDMEM::MEDCouplingFieldDouble::DivideFields;
165 %newobject ParaMEDMEM::MEDCouplingFieldDouble::min;
166 %newobject ParaMEDMEM::MEDCouplingFieldDouble::negate;
167 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getIdsInRange;
168 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart;
169 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildSubPartRange;
170 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__getitem__;
171 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__neg__;
172 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__add__;
173 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__sub__;
174 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__mul__;
175 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__div__;
176 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__pow__;
177 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__radd__;
178 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rsub__;
179 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rmul__;
180 %newobject ParaMEDMEM::MEDCouplingFieldDouble::__rdiv__;
181 %newobject ParaMEDMEM::MEDCouplingFieldDouble::clone;
182 %newobject ParaMEDMEM::MEDCouplingFieldDouble::cloneWithMesh;
183 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
184 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
185 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
186 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
187 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
188 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
189 %newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith;
190 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
191 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
192 %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfFacesPerCell;
193 %newobject ParaMEDMEM::MEDCouplingMesh::computeEffectiveNbOfNodesPerCell;
194 %newobject ParaMEDMEM::MEDCouplingMesh::buildPartRange;
195 %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
196 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
197 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
198 %newobject ParaMEDMEM::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell;
199 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
200 %newobject ParaMEDMEM::MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds;
201 %newobject ParaMEDMEM::MEDCouplingMesh::mergeMyselfWith;
202 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic;
203 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2;
204 %newobject ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3;
205 %newobject ParaMEDMEM::MEDCouplingMesh::getMeasureField;
206 %newobject ParaMEDMEM::MEDCouplingMesh::simplexize;
207 %newobject ParaMEDMEM::MEDCouplingMesh::buildUnstructured;
208 %newobject ParaMEDMEM::MEDCouplingMesh::MergeMeshes;
209 %newobject ParaMEDMEM::MEDCouplingPointSet::zipCoordsTraducer;
210 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellsInBoundingBox;
211 %newobject ParaMEDMEM::MEDCouplingPointSet::findBoundaryNodes;
212 %newobject ParaMEDMEM::MEDCouplingPointSet::buildBoundaryMesh;
213 %newobject ParaMEDMEM::MEDCouplingPointSet::MergeNodesArray;
214 %newobject ParaMEDMEM::MEDCouplingPointSet::buildPartOfMySelf2;
215 %newobject ParaMEDMEM::MEDCouplingPointSet::BuildInstanceFromMeshType;
216 %newobject ParaMEDMEM::MEDCouplingPointSet::zipConnectivityTraducer;
217 %newobject ParaMEDMEM::MEDCouplingPointSet::mergeMyselfWithOnSameCoords;
218 %newobject ParaMEDMEM::MEDCouplingPointSet::fillCellIdsToKeepFromNodeIds;
219 %newobject ParaMEDMEM::MEDCouplingPointSet::getCellIdsLyingOnNodes;
220 %newobject ParaMEDMEM::MEDCouplingPointSet::deepCpyConnectivityOnly;
221 %newobject ParaMEDMEM::MEDCouplingPointSet::getBoundingBoxForBBTree;
222 %newobject ParaMEDMEM::MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells;
223 %newobject ParaMEDMEM::MEDCouplingPointSet::__getitem__;
224 %newobject ParaMEDMEM::MEDCouplingUMesh::New;
225 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivity;
226 %newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
227 %newobject ParaMEDMEM::MEDCouplingUMesh::clone;
228 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
229 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
230 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
231 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
232 %newobject ParaMEDMEM::MEDCouplingUMesh::explode3DMeshTo1D;
233 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
234 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
235 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
236 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
237 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
238 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed;
239 %newobject ParaMEDMEM::MEDCouplingUMesh::buildNewNumberingFromCommNodesFrmt;
240 %newobject ParaMEDMEM::MEDCouplingUMesh::rearrange2ConsecutiveCellTypes;
241 %newobject ParaMEDMEM::MEDCouplingUMesh::sortCellsInMEDFileFrmt;
242 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForMEDFileFrmt;
243 %newobject ParaMEDMEM::MEDCouplingUMesh::convertCellArrayPerGeoType;
244 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
245 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
246 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
247 %newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
248 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
249 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
250 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
251 %newobject ParaMEDMEM::MEDCouplingUMesh::getSkewField;
252 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner;
253 %newobject ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField;
254 %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
255 %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
256 %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
257 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
258 %newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DCells;
259 %newobject ParaMEDMEM::MEDCouplingUMesh::convertIntoSingleGeoTypeMesh;
260 %newobject ParaMEDMEM::MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh;
261 %newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
262 %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
263 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis;
264 %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsCrossingPlane;
265 %newobject ParaMEDMEM::MEDCouplingUMesh::convexEnvelop2D;
266 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeRangesFromTypeDistribution;
267 %newobject ParaMEDMEM::MEDCouplingUMeshCellByTypeEntry::__iter__;
268 %newobject ParaMEDMEM::MEDCouplingUMeshCellEntry::__iter__;
269 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::New;
270 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::getNodalConnectivity;
271 %newobject ParaMEDMEM::MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh;
272 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::New;
273 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::buildSetInstanceFromThis;
274 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::computeDualMesh;
275 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshes;
276 %newobject ParaMEDMEM::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords;
277 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::New;
278 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::getNodalConnectivityIndex;
279 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::buildSetInstanceFromThis;
280 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshes;
281 %newobject ParaMEDMEM::MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords;
282 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::New;
283 %newobject ParaMEDMEM::MEDCouplingExtrudedMesh::build3DUnstructuredMesh;
284 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::buildStructuredSubPart;
285 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::build1SGTUnstructured;
286 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::BuildExplicitIdsFrom;
287 %newobject ParaMEDMEM::MEDCouplingStructuredMesh::Build1GTNodalConnectivity;
288 %newobject ParaMEDMEM::MEDCouplingCMesh::New;
289 %newobject ParaMEDMEM::MEDCouplingCMesh::clone;
290 %newobject ParaMEDMEM::MEDCouplingCMesh::getCoordsAt;
291 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::New;
292 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::clone;
293 %newobject ParaMEDMEM::MEDCouplingCurveLinearMesh::getCoords;
294 %newobject ParaMEDMEM::MEDCouplingMultiFields::New;
295 %newobject ParaMEDMEM::MEDCouplingMultiFields::deepCpy;
296 %newobject ParaMEDMEM::MEDCouplingFieldOverTime::New;
298 %feature("unref") MEDCouplingPointSet "$this->decrRef();"
299 %feature("unref") MEDCouplingMesh "$this->decrRef();"
300 %feature("unref") MEDCouplingUMesh "$this->decrRef();"
301 %feature("unref") MEDCoupling1GTUMesh "$this->decrRef();"
302 %feature("unref") MEDCoupling1SGTUMesh "$this->decrRef();"
303 %feature("unref") MEDCoupling1DGTUMesh "$this->decrRef();"
304 %feature("unref") MEDCouplingExtrudedMesh "$this->decrRef();"
305 %feature("unref") MEDCouplingCMesh "$this->decrRef();"
306 %feature("unref") MEDCouplingField "$this->decrRef();"
307 %feature("unref") MEDCouplingFieldDiscretizationP0 "$this->decrRef();"
308 %feature("unref") MEDCouplingFieldDiscretizationP1 "$this->decrRef();"
309 %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();"
310 %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();"
311 %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();"
312 %feature("unref") MEDCouplingFieldDouble "$this->decrRef();"
313 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
314 %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();"
315 %feature("unref") MEDCouplingMultiFields "$this->decrRef();"
317 %rename(assign) *::operator=;
318 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
319 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
320 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
321 %ignore ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo;
325 %rename (InterpKernelException) INTERP_KERNEL::Exception;
327 %include "MEDCouplingRefCountObject.i"
328 %include "MEDCouplingMemArray.i"
346 CONST_ON_TIME_INTERVAL = 7
347 } TypeOfTimeDiscretization;
355 SINGLE_STATIC_GEO_TYPE_UNSTRUCTURED = 10,
356 SINGLE_DYNAMIC_GEO_TYPE_UNSTRUCTURED = 11
357 } MEDCouplingMeshType;
360 class DataArrayDouble;
361 class MEDCouplingUMesh;
362 class MEDCouplingFieldDouble;
364 %extend RefCountObject
366 std::string getHiddenCppPointer() const
368 std::ostringstream oss; oss << "C++ Pointer address is : " << self;
373 %extend MEDCouplingGaussLocalization
375 std::string __str__() const throw(INTERP_KERNEL::Exception)
377 return self->getStringRepr();
380 std::string __repr__() const throw(INTERP_KERNEL::Exception)
382 std::ostringstream oss; oss << "MEDCouplingGaussLocalization C++ instance at " << self << "." << std::endl;
383 oss << self->getStringRepr();
390 class MEDCouplingMesh : public RefCountObject, public TimeLabel
393 void setName(const char *name);
394 std::string getName() const;
395 void setDescription(const char *descr);
396 std::string getDescription() const;
397 void setTime(double val, int iteration, int order);
398 void setTimeUnit(const char *unit);
399 const char *getTimeUnit() const;
400 virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
401 bool isStructured() const throw(INTERP_KERNEL::Exception);
402 virtual MEDCouplingMesh *deepCpy() const;
403 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
404 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
405 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
406 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
407 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
408 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
409 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
410 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
411 virtual int getNumberOfCells() const throw(INTERP_KERNEL::Exception);
412 virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
413 virtual int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
414 virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
415 virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
416 virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
417 virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
418 virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
419 virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
420 virtual DataArrayInt *computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception);
421 virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
422 virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception);
423 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
424 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
425 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
426 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
427 void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
429 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
430 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
431 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
432 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
433 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
434 virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
435 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
436 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
437 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
438 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
439 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
440 static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
441 static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
442 static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
443 static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
444 static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
445 static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
448 std::string __str__() const throw(INTERP_KERNEL::Exception)
450 return self->simpleRepr();
453 PyObject *getTime() throw(INTERP_KERNEL::Exception)
456 double tmp0=self->getTime(tmp1,tmp2);
457 PyObject *res = PyList_New(3);
458 PyList_SetItem(res,0,SWIG_From_double(tmp0));
459 PyList_SetItem(res,1,SWIG_From_int(tmp1));
460 PyList_SetItem(res,2,SWIG_From_int(tmp2));
464 int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
468 DataArrayDoubleTuple *aa;
469 std::vector<double> bb;
471 int spaceDim=self->getSpaceDimension();
472 const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : ";
473 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
474 return self->getCellContainingPoint(pos,eps);
477 PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
481 DataArrayDoubleTuple *aa;
482 std::vector<double> bb;
484 int spaceDim=self->getSpaceDimension();
485 const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : ";
486 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
487 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
488 self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex);
489 PyObject *ret=PyTuple_New(2);
490 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
491 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
495 PyObject *getCellsContainingPoints(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
497 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> elts,eltsIndex;
498 int spaceDim=self->getSpaceDimension();
500 int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
501 if (!SWIG_IsOK(res1))
504 INTERP_KERNEL::AutoCPtr<double> tmp=convertPyToNewDblArr2(p,&size);
505 int nbOfPoints=size/spaceDim;
508 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !");
510 self->getCellsContainingPoints(tmp,nbOfPoints,eps,elts,eltsIndex);
514 DataArrayDouble *da2=reinterpret_cast< DataArrayDouble * >(da);
516 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
517 da2->checkAllocated();
518 int size=da2->getNumberOfTuples();
519 int nbOfCompo=da2->getNumberOfComponents();
520 if(nbOfCompo!=spaceDim)
522 throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");
524 self->getCellsContainingPoints(da2->getConstPointer(),size,eps,elts,eltsIndex);
526 PyObject *ret=PyTuple_New(2);
527 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
528 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
532 PyObject *getCellsContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
536 DataArrayDoubleTuple *aa;
537 std::vector<double> bb;
539 int spaceDim=self->getSpaceDimension();
540 const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : ";
541 const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true);
542 std::vector<int> elts;
543 self->getCellsContainingPoint(pos,eps,elts);
544 DataArrayInt *ret=DataArrayInt::New();
545 ret->alloc((int)elts.size(),1);
546 std::copy(elts.begin(),elts.end(),ret->getPointer());
547 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
550 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
553 int v0; std::vector<int> v1;
554 const int *ids(convertObjToPossibleCpp1_Safe(li,sw,sz,v0,v1));
555 self->renumberCells(ids,check);
558 PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const throw(INTERP_KERNEL::Exception)
560 DataArrayInt *cellCor, *nodeCor;
561 self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
562 PyObject *res = PyList_New(2);
563 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
564 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
568 PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
570 DataArrayInt *cellCor=0,*nodeCor=0;
571 self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor);
572 PyObject *res = PyList_New(2);
573 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 ));
574 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 ));
578 DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception)
580 DataArrayInt *cellCor=0;
581 self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor);
585 DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception)
588 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
589 if (!SWIG_IsOK(res1))
592 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
593 return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size);
597 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
599 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
600 da2->checkAllocated();
601 return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
604 PyObject *getNodeIdsOfCell(int cellId) const throw(INTERP_KERNEL::Exception)
606 std::vector<int> conn;
607 self->getNodeIdsOfCell(cellId,conn);
608 return convertIntArrToPyList2(conn);
611 PyObject *getCoordinatesOfNode(int nodeId) const throw(INTERP_KERNEL::Exception)
613 std::vector<double> coo;
614 self->getCoordinatesOfNode(nodeId,coo);
615 return convertDblArrToPyList2(coo);
618 void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
622 DataArrayDoubleTuple *aa;
623 std::vector<double> bb;
625 int spaceDim=self->getSpaceDimension();
626 const char msg[]="Python wrap of MEDCouplingPointSet::scale : ";
627 const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true);
628 self->scale(pointPtr,factor);
631 PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
633 int spaceDim=self->getSpaceDimension();
634 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
635 self->getBoundingBox(tmp);
636 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
640 PyObject *isEqualIfNotWhy(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception)
643 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
644 PyObject *ret=PyTuple_New(2);
645 PyObject *ret0Py=ret0?Py_True:Py_False;
647 PyTuple_SetItem(ret,0,ret0Py);
648 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
652 PyObject *buildPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
654 int szArr,sw,iTypppArr;
655 std::vector<int> stdvecTyyppArr;
656 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
657 MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr);
658 if(sw==3)//DataArrayInt
660 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
661 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
662 std::string name=argpt->getName();
664 ret->setName(name.c_str());
666 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
669 PyObject *buildPartAndReduceNodes(PyObject *li) const throw(INTERP_KERNEL::Exception)
671 int szArr,sw,iTypppArr;
672 std::vector<int> stdvecTyyppArr;
674 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
675 MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr);
676 if(sw==3)//DataArrayInt
678 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
679 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
680 std::string name=argpt->getName();
682 ret->setName(name.c_str());
685 PyObject *res = PyList_New(2);
686 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
687 PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
688 PyList_SetItem(res,0,obj0);
689 PyList_SetItem(res,1,obj1);
693 PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const throw(INTERP_KERNEL::Exception)
697 MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr);
698 PyObject *res = PyTuple_New(2);
699 PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 );
702 obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
704 obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b));
705 PyTuple_SetItem(res,0,obj0);
706 PyTuple_SetItem(res,1,obj1);
710 PyObject *getDistributionOfTypes() const throw(INTERP_KERNEL::Exception)
712 std::vector<int> vals=self->getDistributionOfTypes();
714 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !");
715 PyObject *ret=PyList_New((int)vals.size()/3);
716 for(int j=0;j<(int)vals.size()/3;j++)
718 PyObject *ret1=PyList_New(3);
719 PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
720 PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
721 PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
722 PyList_SetItem(ret,j,ret1);
727 DataArrayInt *checkTypeConsistencyAndContig(PyObject *li, PyObject *li2) const throw(INTERP_KERNEL::Exception)
729 std::vector<int> code;
730 std::vector<const DataArrayInt *> idsPerType;
731 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li2,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",idsPerType);
732 convertPyToNewIntArr4(li,1,3,code);
733 return self->checkTypeConsistencyAndContig(code,idsPerType);
736 PyObject *splitProfilePerType(const DataArrayInt *profile) const throw(INTERP_KERNEL::Exception)
738 std::vector<int> code;
739 std::vector<DataArrayInt *> idsInPflPerType;
740 std::vector<DataArrayInt *> idsPerType;
741 self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
742 PyObject *ret=PyTuple_New(3);
745 throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !");
746 PyObject *ret0=PyList_New((int)code.size()/3);
747 for(int j=0;j<(int)code.size()/3;j++)
749 PyObject *ret00=PyList_New(3);
750 PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
751 PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
752 PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
753 PyList_SetItem(ret0,j,ret00);
755 PyTuple_SetItem(ret,0,ret0);
757 PyObject *ret1=PyList_New(idsInPflPerType.size());
758 for(std::size_t j=0;j<idsInPflPerType.size();j++)
759 PyList_SetItem(ret1,j,SWIG_NewPointerObj(SWIG_as_voidptr(idsInPflPerType[j]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
760 PyTuple_SetItem(ret,1,ret1);
761 int n=idsPerType.size();
762 PyObject *ret2=PyList_New(n);
764 PyList_SetItem(ret2,i,SWIG_NewPointerObj(SWIG_as_voidptr(idsPerType[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
765 PyTuple_SetItem(ret,2,ret2);
769 void translate(PyObject *vector) throw(INTERP_KERNEL::Exception)
773 DataArrayDoubleTuple *aa;
774 std::vector<double> bb;
776 int spaceDim=self->getSpaceDimension();
777 const char msg[]="Python wrap of MEDCouplingPointSet::translate : ";
778 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true);
779 self->translate(vectorPtr);
782 void rotate(PyObject *center, double alpha) throw(INTERP_KERNEL::Exception)
784 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
787 DataArrayDoubleTuple *aa;
788 std::vector<double> bb;
790 int spaceDim=self->getSpaceDimension();
791 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
792 self->rotate(centerPtr,0,alpha);
795 void rotate(PyObject *center, PyObject *vector, double alpha) throw(INTERP_KERNEL::Exception)
797 const char msg[]="Python wrap of MEDCouplingPointSet::rotate : ";
799 DataArrayDouble *a,*a2;
800 DataArrayDoubleTuple *aa,*aa2;
801 std::vector<double> bb,bb2;
803 int spaceDim=self->getSpaceDimension();
804 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true);
805 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,spaceDim,false);//vectorPtr can be null in case of space dim 2
806 self->rotate(centerPtr,vectorPtr,alpha);
809 PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
811 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllGeoTypes();
812 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
813 PyObject *res=PyList_New(result.size());
814 for(int i=0;iL!=result.end(); i++, iL++)
815 PyList_SetItem(res,i,PyInt_FromLong(*iL));
819 static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
821 std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
822 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
823 return MEDCouplingMesh::MergeMeshes(tmp);
829 //== MEDCouplingMesh End
831 %include "NormalizedGeometricTypes"
832 %include "MEDCouplingNatureOfFieldEnum"
836 class MEDCouplingNatureOfField
839 static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
840 static std::string GetReprNoThrow(NatureOfField nat);
841 static std::string GetAllPossibilitiesStr();
845 // the MEDCouplingTimeDiscretization classes are not swigged : in case the file can help
846 // include "MEDCouplingTimeDiscretization.i"
850 class MEDCouplingGaussLocalization
853 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
854 const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
855 MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
856 INTERP_KERNEL::NormalizedCellType getType() const throw(INTERP_KERNEL::Exception);
857 void setType(INTERP_KERNEL::NormalizedCellType typ) throw(INTERP_KERNEL::Exception);
858 int getNumberOfGaussPt() const throw(INTERP_KERNEL::Exception);
859 int getDimension() const throw(INTERP_KERNEL::Exception);
860 int getNumberOfPtsInRefCell() const throw(INTERP_KERNEL::Exception);
861 std::string getStringRepr() const throw(INTERP_KERNEL::Exception);
862 void checkCoherency() const throw(INTERP_KERNEL::Exception);
863 bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const throw(INTERP_KERNEL::Exception);
865 const std::vector<double>& getRefCoords() const throw(INTERP_KERNEL::Exception);
866 double getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
867 const std::vector<double>& getGaussCoords() const throw(INTERP_KERNEL::Exception);
868 double getGaussCoord(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
869 const std::vector<double>& getWeights() const throw(INTERP_KERNEL::Exception);
870 double getWeight(int gaussPtIdInCell, double newVal) const throw(INTERP_KERNEL::Exception);
871 void setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
872 void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
873 void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
874 void setRefCoords(const std::vector<double>& refCoo) throw(INTERP_KERNEL::Exception);
875 void setGaussCoords(const std::vector<double>& gsCoo) throw(INTERP_KERNEL::Exception);
876 void setWeights(const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
878 static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
882 %include "MEDCouplingFieldDiscretization.i"
884 //== MEDCouplingPointSet
888 class MEDCouplingPointSet : public ParaMEDMEM::MEDCouplingMesh
891 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
892 DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
893 bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
894 void zipCoords() throw(INTERP_KERNEL::Exception);
895 double getCaracteristicDimension() const throw(INTERP_KERNEL::Exception);
896 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
897 void changeSpaceDimension(int newSpaceDim, double dftVal=0.) throw(INTERP_KERNEL::Exception);
898 void tryToShareSameCoords(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
899 virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) throw(INTERP_KERNEL::Exception);
900 virtual MEDCouplingPointSet *buildPartOfMySelf2(int start, int end, int step) const throw(INTERP_KERNEL::Exception);
901 virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
902 static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
903 static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
904 static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) throw(INTERP_KERNEL::Exception);
905 virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
906 virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
907 virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
908 virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
909 virtual DataArrayInt *findBoundaryNodes() const;
910 virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
911 virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const throw(INTERP_KERNEL::Exception);
912 virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
913 virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const throw(INTERP_KERNEL::Exception);
914 virtual MEDCouplingPointSet *deepCpyConnectivityOnly() const throw(INTERP_KERNEL::Exception);
915 virtual DataArrayDouble *getBoundingBoxForBBTree() const throw(INTERP_KERNEL::Exception);
918 std::string __str__() const throw(INTERP_KERNEL::Exception)
920 return self->simpleRepr();
923 PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const throw(INTERP_KERNEL::Exception)
926 DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
927 PyObject *res = PyList_New(2);
928 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
929 PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
933 PyObject *findCommonNodes(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception)
935 DataArrayInt *comm, *commIndex;
936 self->findCommonNodes(prec,limitTupleId,comm,commIndex);
937 PyObject *res = PyList_New(2);
938 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
939 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
943 PyObject *getCoords() throw(INTERP_KERNEL::Exception)
945 DataArrayDouble *ret1=self->getCoords();
948 return SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,SWIG_POINTER_OWN | 0);
951 PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const throw(INTERP_KERNEL::Exception)
953 int szArr,sw,iTypppArr;
954 std::vector<int> stdvecTyyppArr;
955 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
956 MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords);
957 if(sw==3)//DataArrayInt
959 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
960 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
961 std::string name=argpt->getName();
963 ret->setName(name.c_str());
965 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
968 PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
970 int szArr,sw,iTypppArr;
971 std::vector<int> stdvecTyyppArr;
972 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
973 MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn);
974 if(sw==3)//DataArrayInt
976 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
977 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
978 std::string name=argpt->getName();
980 ret->setName(name.c_str());
982 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
985 virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const throw(INTERP_KERNEL::Exception)
987 int szArr,sw,iTypppArr;
988 std::vector<int> stdvecTyyppArr;
989 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
990 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr);
991 if(sw==3)//DataArrayInt
993 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
994 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
995 std::string name=argpt->getName();
997 ret->setName(name.c_str());
999 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1002 virtual PyObject *buildPartOfMySelfKeepCoords2(int start, int end, int step) const throw(INTERP_KERNEL::Exception)
1004 MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords2(start,end,step);
1005 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1008 PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1010 int szArr,sw,iTypppArr;
1011 std::vector<int> stdvecTyyppArr;
1012 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1013 MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn);
1014 if(sw==3)//DataArrayInt
1016 void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
1017 DataArrayInt *argpt=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
1018 std::string name=argpt->getName();
1020 ret->setName(name.c_str());
1022 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1025 void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1027 int szArr,sw,iTypppArr;
1028 std::vector<int> stdvecTyyppArr;
1029 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1030 self->renumberNodes(tmp,newNbOfNodes);
1033 void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
1035 int szArr,sw,iTypppArr;
1036 std::vector<int> stdvecTyyppArr;
1037 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1038 self->renumberNodes2(tmp,newNbOfNodes);
1041 PyObject *findNodesOnLine(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1043 int spaceDim=self->getSpaceDimension();
1045 DataArrayDouble *a,*a2;
1046 DataArrayDoubleTuple *aa,*aa2;
1047 std::vector<double> bb,bb2;
1049 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st paramater for point.";
1050 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd paramater for vector.";
1051 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1052 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1053 std::vector<int> nodes;
1054 self->findNodesOnLine(p,v,eps,nodes);
1055 DataArrayInt *ret=DataArrayInt::New();
1056 ret->alloc((int)nodes.size(),1);
1057 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1058 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1060 PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
1062 int spaceDim=self->getSpaceDimension();
1064 DataArrayDouble *a,*a2;
1065 DataArrayDoubleTuple *aa,*aa2;
1066 std::vector<double> bb,bb2;
1068 const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st paramater for point.";
1069 const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd paramater for vector.";
1070 const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1071 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
1072 std::vector<int> nodes;
1073 self->findNodesOnPlane(p,v,eps,nodes);
1074 DataArrayInt *ret=DataArrayInt::New();
1075 ret->alloc((int)nodes.size(),1);
1076 std::copy(nodes.begin(),nodes.end(),ret->getPointer());
1077 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1080 PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1084 DataArrayDoubleTuple *aa;
1085 std::vector<double> bb;
1087 int spaceDim=self->getSpaceDimension();
1088 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
1089 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
1090 DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
1091 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1094 PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
1096 DataArrayInt *c=0,*cI=0;
1100 DataArrayDoubleTuple *aa;
1101 std::vector<double> bb;
1103 int spaceDim=self->getSpaceDimension();
1104 const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : ";
1105 const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true);
1106 self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI);
1107 PyObject *ret=PyTuple_New(2);
1108 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1109 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1113 PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1115 DataArrayInt *c=0,*cI=0;
1116 int spaceDim=self->getSpaceDimension();
1119 DataArrayDoubleTuple *aa;
1120 std::vector<double> bb;
1123 const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples);
1124 self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI);
1126 PyObject *ret=PyTuple_New(2);
1127 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1128 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1132 PyObject *getCellsInBoundingBox(PyObject *bbox, double eps) const throw(INTERP_KERNEL::Exception)
1136 DataArrayDoubleTuple *aa;
1137 std::vector<double> bb;
1139 int spaceDim=self->getSpaceDimension();
1140 const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : ";
1141 const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true);
1143 DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps);
1144 return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1147 void duplicateNodesInCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
1151 std::vector<int> multiVal;
1152 std::pair<int, std::pair<int,int> > slic;
1153 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1154 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1158 return self->duplicateNodesInCoords(&singleVal,&singleVal+1);
1160 return self->duplicateNodesInCoords(&multiVal[0],&multiVal[0]+multiVal.size());
1162 return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end());
1164 throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1168 virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
1170 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
1171 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
1172 self->getReverseNodalConnectivity(d0,d1);
1173 PyObject *ret=PyTuple_New(2);
1174 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1175 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1179 virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
1181 DataArrayInt *v0=0,*v1=0;
1182 self->findCommonCells(compType,startCellId,v0,v1);
1183 PyObject *res = PyList_New(2);
1184 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1185 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1190 virtual void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
1193 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1194 if (!SWIG_IsOK(res1))
1197 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1198 self->renumberNodesInConn(tmp);
1202 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1204 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1205 da2->checkAllocated();
1206 self->renumberNodesInConn(da2->getConstPointer());
1210 virtual PyObject *getNodeIdsInUse() const throw(INTERP_KERNEL::Exception)
1213 DataArrayInt *ret0=self->getNodeIdsInUse(ret1);
1214 PyObject *ret=PyTuple_New(2);
1215 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1216 PyTuple_SetItem(ret,1,PyInt_FromLong(ret1));
1220 virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const
1222 DataArrayInt *ret=0;
1224 int szArr,sw,iTypppArr;
1225 std::vector<int> stdvecTyyppArr;
1226 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1227 self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret);
1231 virtual PyObject *mergeNodes(double precision) throw(INTERP_KERNEL::Exception)
1235 DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2);
1236 PyObject *res = PyList_New(3);
1237 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1238 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1239 PyList_SetItem(res,2,SWIG_From_int(ret2));
1243 virtual PyObject *mergeNodes2(double precision) throw(INTERP_KERNEL::Exception)
1247 DataArrayInt *ret0=self->mergeNodes2(precision,ret1,ret2);
1248 PyObject *res = PyList_New(3);
1249 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1250 PyList_SetItem(res,1,SWIG_From_bool(ret1));
1251 PyList_SetItem(res,2,SWIG_From_int(ret2));
1255 DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const throw(INTERP_KERNEL::Exception)
1258 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
1259 if (!SWIG_IsOK(res1))
1262 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1263 return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn);
1267 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1269 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1270 da2->checkAllocated();
1271 return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn);
1275 MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
1279 std::vector<int> multiVal;
1280 std::pair<int, std::pair<int,int> > slic;
1281 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1282 int nbc=self->getNumberOfCells();
1283 convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1290 std::ostringstream oss;
1291 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1292 throw INTERP_KERNEL::Exception(oss.str().c_str());
1295 return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
1300 int tmp=nbc+singleVal;
1301 return self->buildPartOfMySelf(&tmp,&tmp+1,true);
1305 std::ostringstream oss;
1306 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1307 throw INTERP_KERNEL::Exception(oss.str().c_str());
1313 return static_cast<MEDCouplingPointSet *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
1317 return self->buildPartOfMySelf2(slic.first,slic.second.first,slic.second.second,true);
1322 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
1323 daIntTyypp->checkAllocated();
1324 return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
1327 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1331 static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1334 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1335 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1336 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
1337 for(int i=0;i<sz;i++)
1338 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1341 static void Rotate2DAlg(PyObject *center, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1344 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1346 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1347 std::vector<double> val3;
1348 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1349 "Rotate2DAlg",2,true,nbNodes);
1351 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate2DAlg : try another overload method !");
1352 ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,const_cast<double *>(coo));
1355 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
1358 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1359 INTERP_KERNEL::AutoCPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
1360 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1361 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
1362 for(int i=0;i<sz;i++)
1363 PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
1366 static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, PyObject *coords) throw(INTERP_KERNEL::Exception)
1369 INTERP_KERNEL::AutoCPtr<double> c=convertPyToNewDblArr2(center,&sz);
1371 double val0; ParaMEDMEM::DataArrayDouble *val1=0; ParaMEDMEM::DataArrayDoubleTuple *val2=0;
1372 std::vector<double> val3;
1373 const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3,
1374 "Rotate3DAlg",3,true,nbNodes);
1376 throw INTERP_KERNEL::Exception("Invalid call to MEDCouplingPointSet::Rotate3DAlg : try another overload method !");
1377 INTERP_KERNEL::AutoCPtr<double> v=convertPyToNewDblArr2(vect,&sz2);
1378 ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,const_cast<double *>(coo));
1383 //== MEDCouplingPointSet End
1385 class MEDCouplingUMeshCell
1388 INTERP_KERNEL::NormalizedCellType getType() const;
1391 std::string __str__() const throw(INTERP_KERNEL::Exception)
1393 return self->repr();
1396 PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
1399 const int *r=self->getAllConn(ret2);
1400 PyObject *ret=PyTuple_New(ret2);
1401 for(int i=0;i<ret2;i++)
1402 PyTuple_SetItem(ret,i,PyInt_FromLong(r[i]));
1408 class MEDCouplingUMeshCellIterator
1415 MEDCouplingUMeshCell *ret=self->nextt();
1417 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCell,0|0);
1420 PyErr_SetString(PyExc_StopIteration,"No more data.");
1427 class MEDCouplingUMeshCellByTypeIterator
1430 ~MEDCouplingUMeshCellByTypeIterator();
1435 MEDCouplingUMeshCellEntry *ret=self->nextt();
1437 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMeshCellEntry,SWIG_POINTER_OWN | 0);
1440 PyErr_SetString(PyExc_StopIteration,"No more data.");
1447 class MEDCouplingUMeshCellByTypeEntry
1450 ~MEDCouplingUMeshCellByTypeEntry();
1453 MEDCouplingUMeshCellByTypeIterator *__iter__()
1455 return self->iterator();
1460 class MEDCouplingUMeshCellEntry
1463 INTERP_KERNEL::NormalizedCellType getType() const;
1464 int getNumberOfElems() const;
1467 MEDCouplingUMeshCellIterator *__iter__()
1469 return self->iterator();
1474 //== MEDCouplingUMesh
1476 class MEDCouplingUMesh : public ParaMEDMEM::MEDCouplingPointSet
1479 static MEDCouplingUMesh *New() throw(INTERP_KERNEL::Exception);
1480 static MEDCouplingUMesh *New(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception);
1481 MEDCouplingUMesh *clone(bool recDeepCpy) const;
1482 void checkCoherency() const throw(INTERP_KERNEL::Exception);
1483 void setMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
1484 void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
1485 void finishInsertingCells() throw(INTERP_KERNEL::Exception);
1486 MEDCouplingUMeshCellByTypeEntry *cellsByType() throw(INTERP_KERNEL::Exception);
1487 void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
1488 INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
1489 void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
1490 int getMeshLength() const throw(INTERP_KERNEL::Exception);
1491 void computeTypes() throw(INTERP_KERNEL::Exception);
1492 std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
1493 MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
1495 void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
1496 std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
1497 DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
1498 MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception);
1499 bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
1500 bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1501 DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception);
1502 DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
1503 DataArrayInt *getRenumArrForMEDFileFrmt() const throw(INTERP_KERNEL::Exception);
1504 DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
1505 DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
1506 MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1507 MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1508 MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
1509 void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
1510 bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
1511 MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
1512 bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
1513 void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
1514 void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
1515 void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
1516 DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
1517 void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
1518 bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
1519 MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
1520 MEDCouplingFieldDouble *getAspectRatioField() const throw(INTERP_KERNEL::Exception);
1521 MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
1522 MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
1523 DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
1524 std::string cppRepr() const throw(INTERP_KERNEL::Exception);
1525 DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
1526 DataArrayInt *findAndCorrectBadOriented3DCells() throw(INTERP_KERNEL::Exception);
1527 ParaMEDMEM::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1528 DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const throw(INTERP_KERNEL::Exception);
1529 static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
1530 static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1531 static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
1532 static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception);
1533 static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector<int>& code) throw(INTERP_KERNEL::Exception);
1535 MEDCouplingUMesh() throw(INTERP_KERNEL::Exception)
1537 return MEDCouplingUMesh::New();
1540 MEDCouplingUMesh(const char *meshName, int meshDim) throw(INTERP_KERNEL::Exception)
1542 return MEDCouplingUMesh::New(meshName,meshDim);
1545 std::string __str__() const throw(INTERP_KERNEL::Exception)
1547 return self->simpleRepr();
1550 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1552 std::ostringstream oss;
1553 self->reprQuickOverview(oss);
1557 MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
1559 return self->cellIterator();
1562 void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1566 std::vector<int> multiVal;
1567 std::pair<int, std::pair<int,int> > slic;
1568 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1569 int nbc=self->getNumberOfCells();
1570 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1577 std::ostringstream oss;
1578 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1579 throw INTERP_KERNEL::Exception(oss.str().c_str());
1583 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1590 int tmp=nbc+singleVal;
1591 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1596 std::ostringstream oss;
1597 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1598 throw INTERP_KERNEL::Exception(oss.str().c_str());
1604 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1610 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : null instance has been given in input !");
1611 daIntTyypp->checkAllocated();
1612 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1616 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
1620 void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception)
1624 std::vector<int> multiVal;
1625 std::pair<int, std::pair<int,int> > slic;
1626 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1627 int nbc=self->getNumberOfCells();
1628 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
1635 std::ostringstream oss;
1636 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1637 throw INTERP_KERNEL::Exception(oss.str().c_str());
1641 self->setPartOfMySelf(&singleVal,&singleVal+1,otherOnSameCoordsThanThis);
1648 int tmp=nbc+singleVal;
1649 self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis);
1654 std::ostringstream oss;
1655 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
1656 throw INTERP_KERNEL::Exception(oss.str().c_str());
1662 self->setPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),otherOnSameCoordsThanThis);
1667 self->setPartOfMySelf2(slic.first,slic.second.first,slic.second.second,otherOnSameCoordsThanThis);
1673 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : null instance has been given in input !");
1674 daIntTyypp->checkAllocated();
1675 self->setPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),otherOnSameCoordsThanThis);
1679 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !");
1683 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
1685 int szArr,sw,iTypppArr;
1686 std::vector<int> stdvecTyyppArr;
1687 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1690 std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !";
1691 throw INTERP_KERNEL::Exception(oss.str().c_str());
1693 self->insertNextCell(type,size,tmp);
1696 void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
1698 int szArr,sw,iTypppArr;
1699 std::vector<int> stdvecTyyppArr;
1700 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1701 self->insertNextCell(type,szArr,tmp);
1704 DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
1706 DataArrayInt *ret=self->getNodalConnectivity();
1711 DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
1713 DataArrayInt *ret=self->getNodalConnectivityIndex();
1718 PyObject *getAllTypes() const throw(INTERP_KERNEL::Exception)
1720 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getAllTypes();
1721 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
1722 PyObject *res = PyList_New(result.size());
1723 for (int i=0;iL!=result.end(); i++, iL++)
1724 PyList_SetItem(res,i,PyInt_FromLong(*iL));
1728 static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) throw(INTERP_KERNEL::Exception)
1730 int szArr,sw,iTypppArr;
1731 std::vector<int> stdvecTyyppArr;
1732 const int *seedPtr=convertObjToPossibleCpp1_Safe(seed,sw,szArr,iTypppArr,stdvecTyyppArr);
1733 int nbOfDepthPeelingPerformed=0;
1734 DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed);
1735 PyObject *res=PyTuple_New(2);
1736 PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1737 PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed));
1741 static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) throw(INTERP_KERNEL::Exception)
1743 DataArrayInt *v0=0,*v1=0;
1744 MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1);
1745 PyObject *res = PyList_New(2);
1746 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1747 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1751 PyObject *distanceToPoint(PyObject *point) const throw(INTERP_KERNEL::Exception)
1755 DataArrayDoubleTuple *aa;
1756 std::vector<double> bb;
1758 int nbOfCompo=self->getSpaceDimension();
1759 const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true);
1762 double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId);
1763 PyObject *ret=PyTuple_New(2);
1764 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1765 PyTuple_SetItem(ret,1,PyInt_FromLong(cellId));
1769 PyObject *distanceToPoints(const DataArrayDouble *pts) const throw(INTERP_KERNEL::Exception)
1771 DataArrayInt *ret1=0;
1772 DataArrayDouble *ret0=self->distanceToPoints(pts,ret1);
1773 PyObject *ret=PyTuple_New(2);
1774 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1775 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1779 PyObject *tetrahedrize(int policy) throw(INTERP_KERNEL::Exception)
1782 DataArrayInt *ret1(0);
1783 MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2));
1784 PyObject *ret=PyTuple_New(3);
1785 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 ));
1786 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1787 PyTuple_SetItem(ret,2,PyInt_FromLong(ret2));
1791 PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
1793 std::vector<int> cells;
1794 self->checkButterflyCells(cells,eps);
1795 DataArrayInt *ret=DataArrayInt::New();
1796 ret->alloc((int)cells.size(),1);
1797 std::copy(cells.begin(),cells.end(),ret->getPointer());
1798 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
1801 PyObject *splitByType() const throw(INTERP_KERNEL::Exception)
1803 std::vector<MEDCouplingUMesh *> ms=self->splitByType();
1805 PyObject *ret = PyList_New(sz);
1806 for(int i=0;i<sz;i++)
1807 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1811 PyObject *partitionBySpreadZone() const throw(INTERP_KERNEL::Exception)
1813 std::vector<DataArrayInt *> retCpp=self->partitionBySpreadZone();
1814 int sz=retCpp.size();
1815 PyObject *ret=PyList_New(sz);
1816 for(int i=0;i<sz;i++)
1817 PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1821 PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const throw(INTERP_KERNEL::Exception)
1824 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(ids,&size);
1825 MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size);
1826 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 );
1829 bool checkConsecutiveCellTypesAndOrder(PyObject *li) const throw(INTERP_KERNEL::Exception)
1832 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1833 bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
1837 DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const throw(INTERP_KERNEL::Exception)
1840 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1841 DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
1845 PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1847 DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0;
1848 self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2);
1849 PyObject *ret=PyTuple_New(3);
1850 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1851 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1852 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1856 PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception)
1858 DataArrayInt *tmp0=0,*tmp1=0;
1859 self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1);
1860 PyObject *ret=PyTuple_New(2);
1861 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1862 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1866 void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception)
1870 std::vector<int> multiVal;
1871 std::pair<int, std::pair<int,int> > slic;
1872 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1873 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1877 return self->duplicateNodes(&singleVal,&singleVal+1);
1879 return self->duplicateNodes(&multiVal[0],&multiVal[0]+multiVal.size());
1881 return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end());
1883 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1887 void duplicateNodesInConn(PyObject *li, int offset) throw(INTERP_KERNEL::Exception)
1891 std::vector<int> multiVal;
1892 std::pair<int, std::pair<int,int> > slic;
1893 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1894 convertObjToPossibleCpp2(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp);
1898 return self->duplicateNodesInConn(&singleVal,&singleVal+1,offset);
1900 return self->duplicateNodesInConn(&multiVal[0],&multiVal[0]+multiVal.size(),offset);
1902 return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset);
1904 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
1908 PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
1911 INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
1912 DataArrayInt *tmp0,*tmp1=0;
1913 tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
1914 PyObject *ret=PyTuple_New(2);
1915 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1916 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1920 PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const throw(INTERP_KERNEL::Exception)
1922 DataArrayInt *ret0=0,*ret1=0;
1923 self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1);
1924 PyObject *ret=PyTuple_New(2);
1925 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1926 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1930 static PyObject *AggregateSortedByTypeMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1932 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1933 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1934 DataArrayInt *ret1=0,*ret2=0;
1935 MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2);
1936 PyObject *ret=PyTuple_New(3);
1937 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1938 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1939 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1943 static PyObject *MergeUMeshesOnSameCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1945 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> meshes;
1946 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1947 MEDCouplingUMesh *ret=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshes);
1948 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
1951 static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) throw(INTERP_KERNEL::Exception)
1954 std::vector<const MEDCouplingUMesh *> meshes;
1955 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1956 std::vector<DataArrayInt *> corr;
1957 MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
1959 PyObject *ret1=PyList_New(sz);
1960 for(int i=0;i<sz;i++)
1961 PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1962 PyObject *ret=PyList_New(2);
1963 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
1964 PyList_SetItem(ret,1,ret1);
1968 static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
1970 std::vector<MEDCouplingUMesh *> meshes;
1971 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1972 MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
1975 static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
1977 std::vector<MEDCouplingUMesh *> meshes;
1978 convertFromPyObjVectorOfObj<ParaMEDMEM::MEDCouplingUMesh *>(ms,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
1979 MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
1982 static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
1986 std::vector<int> multiVal;
1987 std::pair<int, std::pair<int,int> > slic;
1988 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
1990 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
1991 convertObjToPossibleCpp2(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
1995 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
1997 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
1999 return MEDCouplingUMesh::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2001 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2005 static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2007 DataArrayInt *arrOut=0,*arrIndexOut=0;
2010 std::vector<int> multiVal;
2011 std::pair<int, std::pair<int,int> > slic;
2012 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2014 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2015 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2020 MEDCouplingUMesh::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2025 MEDCouplingUMesh::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2030 MEDCouplingUMesh::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2034 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2036 PyObject *ret=PyTuple_New(2);
2037 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2038 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2042 static PyObject *ExtractFromIndexedArrays2(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2044 DataArrayInt *arrOut=0,*arrIndexOut=0;
2045 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2046 PyObject *ret=PyTuple_New(2);
2047 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2048 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2052 static PyObject *ExtractFromIndexedArrays2(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception)
2054 if(!PySlice_Check(slic))
2055 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : the first param is not a pyslice !");
2056 Py_ssize_t strt=2,stp=2,step=2;
2057 PySliceObject *sliC=reinterpret_cast<PySliceObject *>(slic);
2059 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : last array is null !");
2060 arrIndxIn->checkAllocated();
2061 if(arrIndxIn->getNumberOfComponents()!=1)
2062 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : number of components of last argument must be equal to one !");
2063 if(PySlice_GetIndices(sliC,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step)!=0)
2064 throw INTERP_KERNEL::Exception("ExtractFromIndexedArrays2 (wrap) : Invalid slice regarding nb of elements !");
2065 DataArrayInt *arrOut=0,*arrIndexOut=0;
2066 MEDCouplingUMesh::ExtractFromIndexedArrays2(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2067 PyObject *ret=PyTuple_New(2);
2068 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2069 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2073 static PyObject *SetPartOfIndexedArrays(PyObject *li,
2074 const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2075 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2077 DataArrayInt *arrOut=0,*arrIndexOut=0;
2080 std::vector<int> multiVal;
2081 std::pair<int, std::pair<int,int> > slic;
2082 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2084 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : null pointer as arrIndex !");
2085 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2090 MEDCouplingUMesh::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2095 MEDCouplingUMesh::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2100 MEDCouplingUMesh::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2104 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2106 PyObject *ret=PyTuple_New(2);
2107 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2108 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2112 static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn,
2113 const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception)
2117 std::vector<int> multiVal;
2118 std::pair<int, std::pair<int,int> > slic;
2119 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2121 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2122 convertObjToPossibleCpp2(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2127 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2132 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2137 MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2141 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2145 PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
2149 DataArrayDoubleTuple *aa;
2150 std::vector<double> bb;
2152 int spaceDim=self->getSpaceDimension();
2153 const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : ";
2154 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2156 std::vector<int> cells;
2157 self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
2158 DataArrayInt *ret=DataArrayInt::New();
2159 ret->alloc((int)cells.size(),1);
2160 std::copy(cells.begin(),cells.end(),ret->getPointer());
2161 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2164 void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
2168 DataArrayDoubleTuple *aa;
2169 std::vector<double> bb;
2171 int spaceDim=self->getSpaceDimension();
2172 const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : ";
2173 const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true);
2174 self->orientCorrectly2DCells(v,polyOnly);
2177 PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
2179 std::vector<int> cells;
2180 self->arePolyhedronsNotCorrectlyOriented(cells);
2181 DataArrayInt *ret=DataArrayInt::New();
2182 ret->alloc((int)cells.size(),1);
2183 std::copy(cells.begin(),cells.end(),ret->getPointer());
2184 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2187 PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
2191 self->getFastAveragePlaneOfThis(vec,pos);
2193 std::copy(vec,vec+3,vals);
2194 std::copy(pos,pos+3,vals+3);
2195 return convertDblArrToPyListOfTuple(vals,3,2);
2198 static MEDCouplingUMesh *MergeUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2200 std::vector<const ParaMEDMEM::MEDCouplingUMesh *> tmp;
2201 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",tmp);
2202 return MEDCouplingUMesh::MergeUMeshes(tmp);
2205 PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const throw(INTERP_KERNEL::Exception)
2208 bool ret0=self->areCellsIncludedIn(other,compType,ret1);
2209 PyObject *ret=PyTuple_New(2);
2210 PyObject *ret0Py=ret0?Py_True:Py_False;
2212 PyTuple_SetItem(ret,0,ret0Py);
2213 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2217 PyObject *areCellsIncludedIn2(const MEDCouplingUMesh *other) const throw(INTERP_KERNEL::Exception)
2220 bool ret0=self->areCellsIncludedIn2(other,ret1);
2221 PyObject *ret=PyTuple_New(2);
2222 PyObject *ret0Py=ret0?Py_True:Py_False;
2224 PyTuple_SetItem(ret,0,ret0Py);
2225 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2229 PyObject *explode3DMeshTo1D() const throw(INTERP_KERNEL::Exception)
2231 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2232 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2233 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2234 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2235 MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3);
2236 PyObject *ret=PyTuple_New(5);
2237 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2238 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2239 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2240 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2241 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2245 PyObject *buildDescendingConnectivity() const throw(INTERP_KERNEL::Exception)
2247 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2248 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2249 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2250 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2251 MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3);
2252 PyObject *ret=PyTuple_New(5);
2253 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2254 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2255 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2256 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2257 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2261 PyObject *buildDescendingConnectivity2() const throw(INTERP_KERNEL::Exception)
2263 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2264 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2265 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d2=DataArrayInt::New();
2266 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d3=DataArrayInt::New();
2267 MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3);
2268 PyObject *ret=PyTuple_New(5);
2269 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2270 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2271 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2272 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2273 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2277 PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
2279 DataArrayInt *neighbors=0,*neighborsIdx=0;
2280 self->computeNeighborsOfCells(neighbors,neighborsIdx);
2281 PyObject *ret=PyTuple_New(2);
2282 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2283 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2287 static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception)
2289 DataArrayInt *neighbors=0,*neighborsIdx=0;
2290 MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx);
2291 PyObject *ret=PyTuple_New(2);
2292 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2293 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2297 PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
2299 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
2300 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
2301 DataArrayInt *d2,*d3,*d4,*dd5;
2302 MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5);
2303 PyObject *ret=PyTuple_New(7);
2304 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2305 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2306 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2307 PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2308 PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2309 PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2310 PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2314 DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2317 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2318 da->checkAllocated();
2319 return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2322 DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2325 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2326 da->checkAllocated();
2327 return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2330 MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2333 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2334 da->checkAllocated();
2335 return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2338 PyObject *getTypesOfPart(DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2341 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2342 da->checkAllocated();
2343 std::set<INTERP_KERNEL::NormalizedCellType> result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2344 std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
2345 PyObject *res = PyList_New(result.size());
2346 for (int i=0;iL!=result.end(); i++, iL++)
2347 PyList_SetItem(res,i,PyInt_FromLong(*iL));
2351 DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const throw(INTERP_KERNEL::Exception)
2354 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2355 da->checkAllocated();
2356 DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
2357 ret->setName(da->getName().c_str());
2361 static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) throw(INTERP_KERNEL::Exception)
2363 DataArrayInt *cellNb1=0,*cellNb2=0;
2364 MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2);
2365 PyObject *ret=PyTuple_New(3);
2366 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2367 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2368 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2372 PyObject *buildSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2374 int spaceDim=self->getSpaceDimension();
2376 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3D : works only for spaceDim 3 !");
2378 DataArrayDouble *a,*a2;
2379 DataArrayDoubleTuple *aa,*aa2;
2380 std::vector<double> bb,bb2;
2382 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st paramater for origin.";
2383 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd paramater for vector.";
2384 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2385 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2387 DataArrayInt *cellIds=0;
2388 MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds);
2389 PyObject *ret=PyTuple_New(2);
2390 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2391 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2395 PyObject *buildSlice3DSurf(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2397 int spaceDim=self->getSpaceDimension();
2399 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::buildSlice3DSurf : works only for spaceDim 3 !");
2401 DataArrayDouble *a,*a2;
2402 DataArrayDoubleTuple *aa,*aa2;
2403 std::vector<double> bb,bb2;
2405 const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st paramater for origin.";
2406 const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd paramater for vector.";
2407 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2408 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2410 DataArrayInt *cellIds=0;
2411 MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds);
2412 PyObject *ret=PyTuple_New(2);
2413 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ));
2414 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2418 DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
2420 int spaceDim=self->getSpaceDimension();
2422 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : works only for spaceDim 3 !");
2424 DataArrayDouble *a,*a2;
2425 DataArrayDoubleTuple *aa,*aa2;
2426 std::vector<double> bb,bb2;
2428 const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st paramater for origin.";
2429 const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd paramater for vector.";
2430 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
2431 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
2432 return self->getCellIdsCrossingPlane(orig,vect,eps);
2435 void convertToPolyTypes(PyObject *li) throw(INTERP_KERNEL::Exception)
2439 std::vector<int> pos2;
2440 DataArrayInt *pos3=0;
2441 DataArrayIntTuple *pos4=0;
2442 convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
2447 self->convertToPolyTypes(&pos1,&pos1+1);
2454 self->convertToPolyTypes(&pos2[0],&pos2[0]+pos2.size());
2459 self->convertToPolyTypes(pos3->begin(),pos3->end());
2463 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertToPolyTypes : unexpected input array type recognized !");
2467 void convertAllToPoly();
2468 void convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception);
2469 bool unPolyze() throw(INTERP_KERNEL::Exception);
2470 void simplifyPolyhedra(double eps) throw(INTERP_KERNEL::Exception);
2471 MEDCouplingUMesh *buildSpreadZonesWithPoly() const throw(INTERP_KERNEL::Exception);
2472 MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy) throw(INTERP_KERNEL::Exception);
2475 //== MEDCouplingUMesh End
2477 //== MEDCouplingExtrudedMesh
2479 class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
2482 static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
2483 MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
2485 MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
2487 return MEDCouplingExtrudedMesh::New(mesh3D,mesh2D,cell2DId);
2490 std::string __str__() const throw(INTERP_KERNEL::Exception)
2492 return self->simpleRepr();
2495 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2497 std::ostringstream oss;
2498 self->reprQuickOverview(oss);
2502 PyObject *getMesh2D() const throw(INTERP_KERNEL::Exception)
2504 MEDCouplingUMesh *ret=self->getMesh2D();
2507 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2509 PyObject *getMesh1D() const throw(INTERP_KERNEL::Exception)
2511 MEDCouplingUMesh *ret=self->getMesh1D();
2514 return convertMesh(ret, SWIG_POINTER_OWN | 0 );
2516 PyObject *getMesh3DIds() const throw(INTERP_KERNEL::Exception)
2518 DataArrayInt *ret=self->getMesh3DIds();
2521 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
2526 //== MEDCouplingExtrudedMesh End
2528 class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
2531 static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2532 static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2533 INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
2534 int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
2535 virtual void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
2536 virtual void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
2539 virtual void insertNextCell(PyObject *li) throw(INTERP_KERNEL::Exception)
2541 int szArr,sw,iTypppArr;
2542 std::vector<int> stdvecTyyppArr;
2543 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2544 self->insertNextCell(tmp,tmp+szArr);
2547 virtual DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2549 DataArrayInt *ret=self->getNodalConnectivity();
2550 if(ret) ret->incrRef();
2554 static MEDCouplingUMesh *AggregateOnSameCoordsToUMesh(PyObject *li) throw(INTERP_KERNEL::Exception)
2556 std::vector< const MEDCoupling1GTUMesh *> parts;
2557 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1GTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1GTUMesh,"MEDCoupling1GTUMesh",parts);
2558 return MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(parts);
2563 //== MEDCoupling1SGTUMesh
2565 class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2568 static MEDCoupling1SGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2569 static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2570 void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
2571 int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
2572 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2) throw(INTERP_KERNEL::Exception);
2573 MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2574 MEDCoupling1GTUMesh *computeDualMesh() const throw(INTERP_KERNEL::Exception);
2577 MEDCoupling1SGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2579 return MEDCoupling1SGTUMesh::New(name,type);
2582 MEDCoupling1SGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2584 return MEDCoupling1SGTUMesh::New(m);
2587 std::string __str__() const throw(INTERP_KERNEL::Exception)
2589 return self->simpleRepr();
2592 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2594 std::ostringstream oss;
2595 self->reprQuickOverview(oss);
2599 static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2601 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2602 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2603 return MEDCoupling1SGTUMesh::Merge1SGTUMeshes(tmp);
2606 static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2608 std::vector<const ParaMEDMEM::MEDCoupling1SGTUMesh *> tmp;
2609 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,"MEDCoupling1SGTUMesh",tmp);
2610 return MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(tmp);
2615 //== MEDCoupling1SGTUMesh End
2617 //== MEDCoupling1DGTUMesh
2619 class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
2622 static MEDCoupling1DGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
2623 static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
2624 void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
2625 MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
2626 bool isPacked() const throw(INTERP_KERNEL::Exception);
2629 MEDCoupling1DGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
2631 return MEDCoupling1DGTUMesh::New(name,type);
2634 MEDCoupling1DGTUMesh(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception)
2636 return MEDCoupling1DGTUMesh::New(m);
2639 std::string __str__() const throw(INTERP_KERNEL::Exception)
2641 return self->simpleRepr();
2644 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2646 std::ostringstream oss;
2647 self->reprQuickOverview(oss);
2651 DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
2653 DataArrayInt *ret=self->getNodalConnectivityIndex();
2654 if(ret) ret->incrRef();
2658 PyObject *retrievePackedNodalConnectivity() const throw(INTERP_KERNEL::Exception)
2660 DataArrayInt *ret1=0,*ret2=0;
2661 bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2);
2662 PyObject *ret0Py=ret0?Py_True:Py_False;
2664 PyObject *ret=PyTuple_New(3);
2665 PyTuple_SetItem(ret,0,ret0Py);
2666 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2667 PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2671 PyObject *copyWithNodalConnectivityPacked() const throw(INTERP_KERNEL::Exception)
2674 MEDCoupling1DGTUMesh *ret0=self->copyWithNodalConnectivityPacked(ret1);
2675 PyObject *ret=PyTuple_New(2);
2676 PyObject *ret1Py=ret1?Py_True:Py_False; Py_XINCREF(ret1Py);
2677 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh, SWIG_POINTER_OWN | 0 ));
2678 PyTuple_SetItem(ret,1,ret1Py);
2682 static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
2684 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2685 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2686 return MEDCoupling1DGTUMesh::Merge1DGTUMeshes(tmp);
2689 static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(PyObject *li) throw(INTERP_KERNEL::Exception)
2691 std::vector<const ParaMEDMEM::MEDCoupling1DGTUMesh *> tmp;
2692 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,"MEDCoupling1DGTUMesh",tmp);
2693 return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp);
2696 static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector<int>& offsetInNodeIdsPerElt) throw(INTERP_KERNEL::Exception)
2698 std::vector<const ParaMEDMEM::DataArrayInt *> tmp;
2699 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2700 return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt);
2705 //== MEDCoupling1DGTUMeshEnd
2707 class MEDCouplingStructuredMesh : public ParaMEDMEM::MEDCouplingMesh
2710 int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2711 int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
2712 virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
2713 std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
2714 MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
2715 static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim) throw(INTERP_KERNEL::Exception);
2718 virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const throw(INTERP_KERNEL::Exception)
2720 int tmpp1=-1,tmpp2=-1;
2721 std::vector<int> tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2);
2722 std::vector< std::pair<int,int> > inp;
2726 for(int i=0;i<tmpp1;i++)
2727 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2732 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size ! Must be even size !");
2733 inp.resize(tmpp1/2);
2734 for(int i=0;i<tmpp1/2;i++)
2735 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2738 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.buildStructuredSubPart : invalid input size !");
2739 return self->buildStructuredSubPart(inp);
2742 static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) throw(INTERP_KERNEL::Exception)
2744 int tmpp1=-1,tmpp2=-1;
2745 std::vector<int> tmp=fillArrayWithPyListInt2(part,tmpp1,tmpp2);
2746 std::vector< std::pair<int,int> > inp;
2750 for(int i=0;i<tmpp1;i++)
2751 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2756 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size ! Must be even size !");
2757 inp.resize(tmpp1/2);
2758 for(int i=0;i<tmpp1/2;i++)
2759 { inp[i].first=tmp[2*i]; inp[i].second=tmp[2*i+1]; }
2762 throw INTERP_KERNEL::Exception("Wrap of MEDCouplingStructuredMesh.BuildExplicitIdsFrom : invalid input size !");
2764 int szArr,sw,iTypppArr;
2765 std::vector<int> stdvecTyyppArr;
2766 const int *tmp4=convertObjToPossibleCpp1_Safe(st,sw,szArr,iTypppArr,stdvecTyyppArr);
2767 std::vector<int> tmp5(tmp4,tmp4+szArr);
2769 return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp);
2772 static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) throw(INTERP_KERNEL::Exception)
2774 int szArr,sw,iTypppArr;
2775 std::vector<int> stdvecTyyppArr;
2776 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2777 return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr);
2780 static PyObject *IsPartStructured(PyObject *li, PyObject *st) throw(INTERP_KERNEL::Exception)
2782 int szArr,sw,iTypppArr;
2783 std::vector<int> stdvecTyyppArr;
2784 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
2785 int szArr2,sw2,iTypppArr2;
2786 std::vector<int> stdvecTyyppArr2;
2787 const int *tmp2=convertObjToPossibleCpp1_Safe(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2);
2788 std::vector<int> tmp3(tmp2,tmp2+szArr2);
2789 std::vector< std::pair<int,int> > partCompactFormat;
2790 bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat);
2791 PyObject *ret=PyTuple_New(2);
2792 PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py);
2793 PyTuple_SetItem(ret,0,ret0Py);
2794 PyObject *ret1Py=PyList_New(partCompactFormat.size());
2795 for(std::size_t i=0;i<partCompactFormat.size();i++)
2797 PyObject *tmp4=PyTuple_New(2);
2798 PyTuple_SetItem(tmp4,0,PyInt_FromLong(partCompactFormat[i].first));
2799 PyTuple_SetItem(tmp4,1,PyInt_FromLong(partCompactFormat[i].second));
2800 PyList_SetItem(ret1Py,i,tmp4);
2802 PyTuple_SetItem(ret,1,ret1Py);
2808 //== MEDCouplingCMesh
2810 class MEDCouplingCMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2813 static MEDCouplingCMesh *New();
2814 static MEDCouplingCMesh *New(const char *meshName);
2815 MEDCouplingCMesh *clone(bool recDeepCpy) const;
2816 void setCoords(const DataArrayDouble *coordsX,
2817 const DataArrayDouble *coordsY=0,
2818 const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
2819 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
2823 return MEDCouplingCMesh::New();
2825 MEDCouplingCMesh(const char *meshName)
2827 return MEDCouplingCMesh::New(meshName);
2829 std::string __str__() const throw(INTERP_KERNEL::Exception)
2831 return self->simpleRepr();
2833 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2835 std::ostringstream oss;
2836 self->reprQuickOverview(oss);
2839 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
2841 DataArrayDouble *ret=self->getCoordsAt(i);
2849 //== MEDCouplingCMesh End
2851 //== MEDCouplingCurveLinearMesh
2853 class MEDCouplingCurveLinearMesh : public ParaMEDMEM::MEDCouplingStructuredMesh
2856 static MEDCouplingCurveLinearMesh *New();
2857 static MEDCouplingCurveLinearMesh *New(const char *meshName);
2858 MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
2859 void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
2861 MEDCouplingCurveLinearMesh()
2863 return MEDCouplingCurveLinearMesh::New();
2865 MEDCouplingCurveLinearMesh(const char *meshName)
2867 return MEDCouplingCurveLinearMesh::New(meshName);
2869 std::string __str__() const throw(INTERP_KERNEL::Exception)
2871 return self->simpleRepr();
2873 std::string __repr__() const throw(INTERP_KERNEL::Exception)
2875 std::ostringstream oss;
2876 self->reprQuickOverview(oss);
2879 DataArrayDouble *getCoords() throw(INTERP_KERNEL::Exception)
2881 DataArrayDouble *ret=self->getCoords();
2886 void setNodeGridStructure(PyObject *gridStruct) throw(INTERP_KERNEL::Exception)
2888 int szArr,sw,iTypppArr;
2889 std::vector<int> stdvecTyyppArr;
2890 const int *tmp=convertObjToPossibleCpp1_Safe(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr);
2891 self->setNodeGridStructure(tmp,tmp+szArr);
2896 //== MEDCouplingCurveLinearMesh End
2899 namespace ParaMEDMEM
2901 class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel
2904 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
2905 virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
2906 virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2907 virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
2908 virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
2909 void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
2910 void setName(const char *name) throw(INTERP_KERNEL::Exception);
2911 std::string getDescription() const throw(INTERP_KERNEL::Exception);
2912 void setDescription(const char *desc) throw(INTERP_KERNEL::Exception);
2913 std::string getName() const throw(INTERP_KERNEL::Exception);
2914 TypeOfField getTypeOfField() const throw(INTERP_KERNEL::Exception);
2915 NatureOfField getNature() const throw(INTERP_KERNEL::Exception);
2916 virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
2917 DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
2918 MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
2919 int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
2920 int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
2921 void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
2922 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
2923 void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
2924 MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
2925 int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
2926 int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
2927 const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
2928 int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
2929 void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
2931 PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
2933 MEDCouplingMesh *ret1=const_cast<MEDCouplingMesh *>(self->getMesh());
2936 return convertMesh(ret1,SWIG_POINTER_OWN | 0 );
2939 PyObject *getDiscretization() throw(INTERP_KERNEL::Exception)
2941 MEDCouplingFieldDiscretization *ret=self->getDiscretization();
2944 return convertFieldDiscretization(ret,SWIG_POINTER_OWN | 0 );
2947 PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
2949 std::set<int> ret=self->getGaussLocalizationIdsOfOneType(type);
2950 return convertIntArrToPyList3(ret);
2953 PyObject *isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception)
2956 bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1);
2957 PyObject *ret=PyTuple_New(2);
2958 PyObject *ret0Py=ret0?Py_True:Py_False;
2960 PyTuple_SetItem(ret,0,ret0Py);
2961 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2965 PyObject *buildSubMeshData(PyObject *li) const throw(INTERP_KERNEL::Exception)
2967 DataArrayInt *ret1=0;
2968 MEDCouplingMesh *ret0=0;
2970 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2971 if (!SWIG_IsOK(res1))
2974 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2975 ret0=self->buildSubMeshData(tmp,tmp+size,ret1);
2979 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2981 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2982 da2->checkAllocated();
2983 ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1);
2985 PyObject *res = PyList_New(2);
2986 PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
2987 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2991 PyObject *buildSubMeshDataRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception)
2993 DataArrayInt *ret1=0;
2995 MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1);
2996 PyObject *res=PyTuple_New(2);
2997 PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 ));
2999 PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3002 PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss));
3003 PyTuple_SetItem(res,1,res1);
3008 DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const
3011 int v0; std::vector<int> v1;
3012 const int *cellIdsBg(convertObjToPossibleCpp1_Safe(cellIds,sw,sz,v0,v1));
3013 return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz);
3016 void setGaussLocalizationOnCells(PyObject *li, const std::vector<double>& refCoo,
3017 const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
3020 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3021 if (!SWIG_IsOK(res1))
3024 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3025 self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg);
3029 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3031 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3032 da2->checkAllocated();
3033 self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg);
3037 PyObject *getCellIdsHavingGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception)
3039 std::vector<int> tmp;
3040 self->getCellIdsHavingGaussLocalization(locId,tmp);
3041 DataArrayInt *ret=DataArrayInt::New();
3042 ret->alloc((int)tmp.size(),1);
3043 std::copy(tmp.begin(),tmp.end(),ret->getPointer());
3044 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3047 int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const throw(INTERP_KERNEL::Exception)
3049 std::vector<int> inp0;
3050 convertPyToNewIntArr4(code,1,3,inp0);
3051 std::vector<const DataArrayInt *> inp1;
3052 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(idsPerType,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",inp1);
3053 return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1);
3058 class MEDCouplingFieldTemplate : public ParaMEDMEM::MEDCouplingField
3061 static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception);
3062 static MEDCouplingFieldTemplate *New(TypeOfField type);
3063 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3064 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3067 MEDCouplingFieldTemplate(const MEDCouplingFieldDouble& f) throw(INTERP_KERNEL::Exception)
3069 return MEDCouplingFieldTemplate::New(f);
3072 MEDCouplingFieldTemplate(TypeOfField type) throw(INTERP_KERNEL::Exception)
3074 return MEDCouplingFieldTemplate::New(type);
3077 std::string __str__() const throw(INTERP_KERNEL::Exception)
3079 return self->simpleRepr();
3082 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3084 std::ostringstream oss;
3085 self->reprQuickOverview(oss);
3091 class MEDCouplingFieldDouble : public ParaMEDMEM::MEDCouplingField
3094 static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
3095 static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
3096 void setTimeUnit(const char *unit);
3097 const char *getTimeUnit() const;
3098 void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
3099 void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3100 void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
3101 std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
3102 std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
3103 void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
3104 MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
3105 MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
3106 MEDCouplingFieldDouble *deepCpy() const;
3107 MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
3108 MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
3109 TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
3110 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
3111 double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
3112 void synchronizeTimeWithMesh() throw(INTERP_KERNEL::Exception);
3113 void setArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3114 void setEndArray(DataArrayDouble *array) throw(INTERP_KERNEL::Exception);
3115 void setTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3116 void setStartTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3117 void setEndTime(double val, int iteration, int order) throw(INTERP_KERNEL::Exception);
3118 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
3119 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
3120 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
3121 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
3122 void setTimeTolerance(double val) throw(INTERP_KERNEL::Exception);
3123 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
3124 void setIteration(int it) throw(INTERP_KERNEL::Exception);
3125 void setEndIteration(int it) throw(INTERP_KERNEL::Exception);
3126 void setOrder(int order) throw(INTERP_KERNEL::Exception);
3127 void setEndOrder(int order) throw(INTERP_KERNEL::Exception);
3128 void setTimeValue(double val) throw(INTERP_KERNEL::Exception);
3129 void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception);
3130 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3131 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double precOnMesh, double eps=1e-15) throw(INTERP_KERNEL::Exception);
3132 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3133 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3134 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3135 bool zipConnectivity(int compType,double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
3136 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
3137 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
3138 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
3139 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
3140 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
3141 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
3142 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
3143 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
3144 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
3145 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
3146 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
3147 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
3148 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
3149 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3150 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3151 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3152 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3153 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
3154 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
3155 void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
3156 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
3157 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
3158 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
3159 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
3160 double getMaxValue() const throw(INTERP_KERNEL::Exception);
3161 double getMinValue() const throw(INTERP_KERNEL::Exception);
3162 double getAverageValue() const throw(INTERP_KERNEL::Exception);
3163 double norm2() const throw(INTERP_KERNEL::Exception);
3164 double normMax() const throw(INTERP_KERNEL::Exception);
3165 //do not put a default value to isWAbs because confusion in python with overloaded getWeightedAverageValue method
3166 double getWeightedAverageValue(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3167 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
3168 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
3169 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
3170 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
3171 MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const throw(INTERP_KERNEL::Exception);
3172 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3173 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3174 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3175 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3176 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3177 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3178 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3179 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3180 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3181 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3182 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3183 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3184 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
3185 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
3186 MEDCouplingFieldDouble *negate() const throw(INTERP_KERNEL::Exception);
3188 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME)
3190 return MEDCouplingFieldDouble::New(type,td);
3193 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME)
3195 return MEDCouplingFieldDouble::New(ft,td);
3198 std::string __str__() const throw(INTERP_KERNEL::Exception)
3200 return self->simpleRepr();
3203 std::string __repr__() const throw(INTERP_KERNEL::Exception)
3205 std::ostringstream oss;
3206 self->reprQuickOverview(oss);
3210 DataArrayDouble *getArray() throw(INTERP_KERNEL::Exception)
3212 DataArrayDouble *ret=self->getArray();
3218 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
3220 std::vector<DataArrayDouble *> arrs=self->getArrays();
3221 for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
3225 PyObject *ret=PyTuple_New(sz);
3226 for(int i=0;i<sz;i++)
3229 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
3231 PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 ));
3236 void setArrays(PyObject *ls) throw(INTERP_KERNEL::Exception)
3238 std::vector<const DataArrayDouble *> tmp;
3239 convertFromPyObjVectorOfObj<const DataArrayDouble *>(ls,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
3241 std::vector<DataArrayDouble *> arrs(sz);
3242 for(int i=0;i<sz;i++)
3243 arrs[i]=const_cast<DataArrayDouble *>(tmp[i]);
3244 self->setArrays(arrs);
3247 DataArrayDouble *getEndArray() throw(INTERP_KERNEL::Exception)
3249 DataArrayDouble *ret=self->getEndArray();
3255 PyObject *getValueOn(PyObject *sl) const throw(INTERP_KERNEL::Exception)
3259 DataArrayDoubleTuple *aa;
3260 std::vector<double> bb;
3262 const MEDCouplingMesh *mesh=self->getMesh();
3264 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3265 int spaceDim=mesh->getSpaceDimension();
3266 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3267 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3269 int sz=self->getNumberOfComponents();
3270 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3271 self->getValueOn(spaceLoc,res);
3272 return convertDblArrToPyList(res,sz);
3275 PyObject *getValueOnPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception)
3277 int sz=self->getNumberOfComponents();
3278 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3279 self->getValueOnPos(i,j,k,res);
3280 return convertDblArrToPyList(res,sz);
3283 DataArrayDouble *getValueOnMulti(PyObject *locs) const throw(INTERP_KERNEL::Exception)
3285 const MEDCouplingMesh *mesh(self->getMesh());
3287 throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !");
3290 double v0; ParaMEDMEM::DataArrayDouble *v1(0); ParaMEDMEM::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
3291 const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
3292 mesh->getSpaceDimension(),true,nbPts);
3293 return self->getValueOnMulti(inp,nbPts);
3296 PyObject *getValueOn(PyObject *sl, double time) const throw(INTERP_KERNEL::Exception)
3300 DataArrayDoubleTuple *aa;
3301 std::vector<double> bb;
3303 const MEDCouplingMesh *mesh=self->getMesh();
3305 throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !");
3306 int spaceDim=mesh->getSpaceDimension();
3307 const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
3308 const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
3311 int sz=self->getNumberOfComponents();
3312 INTERP_KERNEL::AutoPtr<double> res=new double[sz];
3313 self->getValueOn(spaceLoc,time,res);
3314 return convertDblArrToPyList(res,sz);
3317 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
3319 if(self->getArray()!=0)
3320 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(self->getArray(),li,nbOfTuples,nbOfComp);
3323 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
3324 ParaMEDMEM_DataArrayDouble_setValues__SWIG_0(arr,li,nbOfTuples,nbOfComp);
3325 self->setArray(arr);
3329 PyObject *getTime() throw(INTERP_KERNEL::Exception)
3332 double tmp0=self->getTime(tmp1,tmp2);
3333 PyObject *res = PyList_New(3);
3334 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3335 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3336 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3340 PyObject *getStartTime() throw(INTERP_KERNEL::Exception)
3343 double tmp0=self->getStartTime(tmp1,tmp2);
3344 PyObject *res = PyList_New(3);
3345 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3346 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3347 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3351 PyObject *getEndTime() throw(INTERP_KERNEL::Exception)
3354 double tmp0=self->getEndTime(tmp1,tmp2);
3355 PyObject *res = PyList_New(3);
3356 PyList_SetItem(res,0,SWIG_From_double(tmp0));
3357 PyList_SetItem(res,1,SWIG_From_int(tmp1));
3358 PyList_SetItem(res,2,SWIG_From_int(tmp2));
3361 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
3363 int sz=self->getNumberOfComponents();
3364 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3365 self->accumulate(tmp);
3366 return convertDblArrToPyList(tmp,sz);
3368 PyObject *integral(bool isWAbs) const throw(INTERP_KERNEL::Exception)
3370 int sz=self->getNumberOfComponents();
3371 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3372 self->integral(isWAbs,tmp);
3373 return convertDblArrToPyList(tmp,sz);
3375 PyObject *getWeightedAverageValue(bool isWAbs=true) const throw(INTERP_KERNEL::Exception)
3377 int sz=self->getNumberOfComponents();
3378 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3379 self->getWeightedAverageValue(tmp,isWAbs);
3380 return convertDblArrToPyList(tmp,sz);
3382 PyObject *normL1() const throw(INTERP_KERNEL::Exception)
3384 int sz=self->getNumberOfComponents();
3385 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3387 return convertDblArrToPyList(tmp,sz);
3389 PyObject *normL2() const throw(INTERP_KERNEL::Exception)
3391 int sz=self->getNumberOfComponents();
3392 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
3394 return convertDblArrToPyList(tmp,sz);
3396 void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3398 int szArr,sw,iTypppArr;
3399 std::vector<int> stdvecTyyppArr;
3400 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3401 self->renumberCells(tmp,check);
3404 void renumberCellsWithoutMesh(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
3406 int szArr,sw,iTypppArr;
3407 std::vector<int> stdvecTyyppArr;
3408 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3409 self->renumberCellsWithoutMesh(tmp,check);
3412 void renumberNodes(PyObject *li, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3414 int szArr,sw,iTypppArr;
3415 std::vector<int> stdvecTyyppArr;
3416 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3417 self->renumberNodes(tmp,eps);
3420 void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) throw(INTERP_KERNEL::Exception)
3422 int szArr,sw,iTypppArr;
3423 std::vector<int> stdvecTyyppArr;
3424 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
3425 self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps);
3428 MEDCouplingFieldDouble *buildSubPart(PyObject *li) const throw(INTERP_KERNEL::Exception)
3432 std::vector<int> multiVal;
3433 std::pair<int, std::pair<int,int> > slic;
3434 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3435 const MEDCouplingMesh *mesh=self->getMesh();
3437 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !");
3438 int nbc=mesh->getNumberOfCells();
3439 convertObjToPossibleCpp2(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
3446 std::ostringstream oss;
3447 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3448 throw INTERP_KERNEL::Exception(oss.str().c_str());
3451 return self->buildSubPart(&singleVal,&singleVal+1);
3456 int tmp=nbc+singleVal;
3457 return self->buildSubPart(&tmp,&tmp+1);
3461 std::ostringstream oss;
3462 oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
3463 throw INTERP_KERNEL::Exception(oss.str().c_str());
3469 return self->buildSubPart(&multiVal[0],&multiVal[0]+multiVal.size());
3473 return self->buildSubPartRange(slic.first,slic.second.first,slic.second.second);
3478 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : null instance has been given in input !");
3479 daIntTyypp->checkAllocated();
3480 return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end());
3483 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
3487 MEDCouplingFieldDouble *__getitem__(PyObject *li) const throw(INTERP_KERNEL::Exception)
3489 const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call Available API are : \n-myField[dataArrayInt]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[dataArrayInt,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n";
3490 if(PyTuple_Check(li))
3492 Py_ssize_t sz=PyTuple_Size(li);
3494 throw INTERP_KERNEL::Exception(msg);
3495 PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1);
3498 std::vector<int> multiVal;
3499 std::pair<int, std::pair<int,int> > slic;
3500 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3501 if(!self->getArray())
3502 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
3504 { convertObjToPossibleCpp2(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
3505 catch(INTERP_KERNEL::Exception& e)
3506 { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
3507 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret0=ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,elt0);
3508 DataArrayDouble *ret0Arr=ret0->getArray();
3510 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array exists to apply restriction on component on it !");
3515 std::vector<int> v2(1,singleVal);
3516 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3517 ret0->setArray(aarr);
3522 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(multiVal));
3523 ret0->setArray(aarr);
3528 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !");
3529 std::vector<int> v2(nbOfComp);
3530 for(int i=0;i<nbOfComp;i++)
3531 v2[i]=slic.first+i*slic.second.second;
3532 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aarr=static_cast<DataArrayDouble *>(ret0Arr->keepSelectedComponents(v2));
3533 ret0->setArray(aarr);
3537 throw INTERP_KERNEL::Exception(msg);
3542 return ParaMEDMEM_MEDCouplingFieldDouble_buildSubPart(self,li);
3545 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
3548 double r1=self->getMaxValue2(tmp);
3549 PyObject *ret=PyTuple_New(2);
3550 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3551 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3555 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
3558 double r1=self->getMinValue2(tmp);
3559 PyObject *ret=PyTuple_New(2);
3560 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
3561 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3565 MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
3567 std::vector<int> tmp;
3568 convertPyToNewIntArr3(li,tmp);
3569 return self->keepSelectedComponents(tmp);
3572 void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
3574 std::vector<int> tmp;
3575 convertPyToNewIntArr3(li,tmp);
3576 self->setSelectedComponents(f,tmp);
3579 MEDCouplingFieldDouble *extractSlice3D(PyObject *origin, PyObject *vec, double eps) const throw(INTERP_KERNEL::Exception)
3582 DataArrayDouble *a,*a2;
3583 DataArrayDoubleTuple *aa,*aa2;
3584 std::vector<double> bb,bb2;
3587 const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st paramater for origin.";
3588 const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd paramater for vector.";
3589 const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true);
3590 const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true);
3592 return self->extractSlice3D(orig,vect,eps);
3595 MEDCouplingFieldDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3597 return ParaMEDMEM_MEDCouplingFieldDouble___add__Impl(self,obj);
3600 MEDCouplingFieldDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3602 return ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(self,obj);
3605 MEDCouplingFieldDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3607 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__sub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3608 const char msg2[]="in MEDCouplingFieldDouble.__sub__ : self field has no Array of values set !";
3611 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3613 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3615 return (*self)-(*other);
3617 throw INTERP_KERNEL::Exception(msg);
3622 DataArrayDoubleTuple *aa;
3623 std::vector<double> bb;
3625 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3630 if(!self->getArray())
3631 throw INTERP_KERNEL::Exception(msg2);
3632 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3633 ret->applyLin(1.,-val);
3634 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3635 ret2->setArray(ret);
3640 if(!self->getArray())
3641 throw INTERP_KERNEL::Exception(msg2);
3642 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),a);
3643 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3644 ret2->setArray(ret);
3649 if(!self->getArray())
3650 throw INTERP_KERNEL::Exception(msg2);
3651 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3652 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3653 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3654 ret2->setArray(ret);
3659 if(!self->getArray())
3660 throw INTERP_KERNEL::Exception(msg2);
3661 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3662 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Substract(self->getArray(),aaa);
3663 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3664 ret2->setArray(ret);
3668 { throw INTERP_KERNEL::Exception(msg); }
3672 MEDCouplingFieldDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3674 return ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(self,obj);
3677 MEDCouplingFieldDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3679 return ParaMEDMEM_MEDCouplingFieldDouble___mul__Impl(self,obj);
3682 MEDCouplingFieldDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3684 return ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(self,obj);
3687 MEDCouplingFieldDouble *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3689 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__div__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3690 const char msg2[]="in MEDCouplingFieldDouble.__div__ : self field has no Array of values set !";
3693 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3695 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3697 return (*self)/(*other);
3699 throw INTERP_KERNEL::Exception(msg);
3704 DataArrayDoubleTuple *aa;
3705 std::vector<double> bb;
3707 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3713 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__div__ : trying to divide by zero !");
3714 if(!self->getArray())
3715 throw INTERP_KERNEL::Exception(msg2);
3716 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3717 ret->applyLin(1./val,0);
3718 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3719 ret2->setArray(ret);
3724 if(!self->getArray())
3725 throw INTERP_KERNEL::Exception(msg2);
3726 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),a);
3727 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3728 ret2->setArray(ret);
3733 if(!self->getArray())
3734 throw INTERP_KERNEL::Exception(msg2);
3735 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3736 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3737 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3738 ret2->setArray(ret);
3743 if(!self->getArray())
3744 throw INTERP_KERNEL::Exception(msg2);
3745 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3746 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Divide(self->getArray(),aaa);
3747 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3748 ret2->setArray(ret);
3752 { throw INTERP_KERNEL::Exception(msg); }
3756 MEDCouplingFieldDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3758 return ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(self,obj);
3761 MEDCouplingFieldDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3763 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__pow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3764 const char msg2[]="in MEDCouplingFieldDouble.__pow__ : self field has no Array of values set !";
3767 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3769 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3771 return (*self)^(*other);
3773 throw INTERP_KERNEL::Exception(msg);
3778 DataArrayDoubleTuple *aa;
3779 std::vector<double> bb;
3781 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3786 if(!self->getArray())
3787 throw INTERP_KERNEL::Exception(msg2);
3788 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->getArray()->deepCpy();
3790 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3791 ret2->setArray(ret);
3796 if(!self->getArray())
3797 throw INTERP_KERNEL::Exception(msg2);
3798 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),a);
3799 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3800 ret2->setArray(ret);
3805 if(!self->getArray())
3806 throw INTERP_KERNEL::Exception(msg2);
3807 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3808 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3809 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3810 ret2->setArray(ret);
3815 if(!self->getArray())
3816 throw INTERP_KERNEL::Exception(msg2);
3817 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3818 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::Pow(self->getArray(),aaa);
3819 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3820 ret2->setArray(ret);
3824 { throw INTERP_KERNEL::Exception(msg); }
3828 MEDCouplingFieldDouble *__neg__() const throw(INTERP_KERNEL::Exception)
3830 return self->negate();
3833 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3835 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__iadd__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3836 const char msg2[]="in MEDCouplingFieldDouble.__iadd__ : self field has no Array of values set !";
3839 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3841 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3845 Py_XINCREF(trueSelf);
3849 throw INTERP_KERNEL::Exception(msg);
3854 DataArrayDoubleTuple *aa;
3855 std::vector<double> bb;
3857 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3862 if(!self->getArray())
3863 throw INTERP_KERNEL::Exception(msg2);
3864 self->getArray()->applyLin(1.,val);
3865 Py_XINCREF(trueSelf);
3870 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3873 Py_XINCREF(trueSelf);
3878 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3879 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3880 ret2->setArray(aaa);
3882 Py_XINCREF(trueSelf);
3887 if(!self->getArray())
3888 throw INTERP_KERNEL::Exception(msg2);
3889 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3890 self->getArray()->addEqual(aaa);
3891 Py_XINCREF(trueSelf);
3895 { throw INTERP_KERNEL::Exception(msg); }
3899 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3901 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__isub__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3902 const char msg2[]="in MEDCouplingFieldDouble.__isub__ : self field has no Array of values set !";
3905 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3907 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3911 Py_XINCREF(trueSelf);
3915 throw INTERP_KERNEL::Exception(msg);
3920 DataArrayDoubleTuple *aa;
3921 std::vector<double> bb;
3923 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3928 if(!self->getArray())
3929 throw INTERP_KERNEL::Exception(msg2);
3930 self->getArray()->applyLin(1.,-val);
3931 Py_XINCREF(trueSelf);
3936 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3939 Py_XINCREF(trueSelf);
3944 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
3945 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
3946 ret2->setArray(aaa);
3948 Py_XINCREF(trueSelf);
3953 if(!self->getArray())
3954 throw INTERP_KERNEL::Exception(msg2);
3955 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
3956 self->getArray()->substractEqual(aaa);
3957 Py_XINCREF(trueSelf);
3961 { throw INTERP_KERNEL::Exception(msg); }
3965 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3967 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__imul__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
3968 const char msg2[]="in MEDCouplingFieldDouble.__imul__ : self field has no Array of values set !";
3971 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
3973 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
3977 Py_XINCREF(trueSelf);
3981 throw INTERP_KERNEL::Exception(msg);
3986 DataArrayDoubleTuple *aa;
3987 std::vector<double> bb;
3989 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
3994 if(!self->getArray())
3995 throw INTERP_KERNEL::Exception(msg2);
3996 self->getArray()->applyLin(val,0);
3997 Py_XINCREF(trueSelf);
4002 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4005 Py_XINCREF(trueSelf);
4010 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4011 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4012 ret2->setArray(aaa);
4014 Py_XINCREF(trueSelf);
4019 if(!self->getArray())
4020 throw INTERP_KERNEL::Exception(msg2);
4021 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4022 self->getArray()->multiplyEqual(aaa);
4023 Py_XINCREF(trueSelf);
4027 { throw INTERP_KERNEL::Exception(msg); }
4031 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4033 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__idiv__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4034 const char msg2[]="in MEDCouplingFieldDouble.__idiv__ : self field has no Array of values set !";
4037 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4039 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4043 Py_XINCREF(trueSelf);
4047 throw INTERP_KERNEL::Exception(msg);
4052 DataArrayDoubleTuple *aa;
4053 std::vector<double> bb;
4055 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4061 throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble.__idiv__ : trying to divide by zero !");
4062 if(!self->getArray())
4063 throw INTERP_KERNEL::Exception(msg2);
4064 self->getArray()->applyLin(1./val,0);
4065 Py_XINCREF(trueSelf);
4070 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4073 Py_XINCREF(trueSelf);
4078 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4079 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4080 ret2->setArray(aaa);
4082 Py_XINCREF(trueSelf);
4087 if(!self->getArray())
4088 throw INTERP_KERNEL::Exception(msg2);
4089 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4090 self->getArray()->divideEqual(aaa);
4091 Py_XINCREF(trueSelf);
4095 { throw INTERP_KERNEL::Exception(msg); }
4099 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4101 const char msg[]="Unexpected situation in MEDCouplingFieldDouble.__ipow__ ! Expecting a not null MEDCouplingFieldDouble or DataArrayDouble or DataArrayDoubleTuple instance, or a list of double, or a double.";
4102 const char msg2[]="in MEDCouplingFieldDouble.__ipow__ : self field has no Array of values set !";
4105 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
4107 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
4111 Py_XINCREF(trueSelf);
4115 throw INTERP_KERNEL::Exception(msg);
4120 DataArrayDoubleTuple *aa;
4121 std::vector<double> bb;
4123 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
4128 if(!self->getArray())
4129 throw INTERP_KERNEL::Exception(msg2);
4130 self->getArray()->applyPow(val);
4131 Py_XINCREF(trueSelf);
4136 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4139 Py_XINCREF(trueSelf);
4144 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
4145 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret2=self->clone(false);
4146 ret2->setArray(aaa);
4148 Py_XINCREF(trueSelf);
4153 if(!self->getArray())
4154 throw INTERP_KERNEL::Exception(msg2);
4155 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
4156 self->getArray()->powEqual(aaa);
4157 Py_XINCREF(trueSelf);
4161 { throw INTERP_KERNEL::Exception(msg); }
4165 static MEDCouplingFieldDouble *MergeFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4167 std::vector<const MEDCouplingFieldDouble *> tmp;
4168 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4169 return MEDCouplingFieldDouble::MergeFields(tmp);
4172 static void WriteVTK(const char *fileName, PyObject *li, bool isBinary=true) throw(INTERP_KERNEL::Exception)
4174 std::vector<const MEDCouplingFieldDouble *> tmp;
4175 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4176 MEDCouplingFieldDouble::WriteVTK(fileName,tmp,isBinary);
4181 class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
4184 int getNumberOfFields() const;
4185 MEDCouplingMultiFields *deepCpy() const;
4186 virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
4187 virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
4188 virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4189 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
4190 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
4193 std::string __str__() const throw(INTERP_KERNEL::Exception)
4195 return self->simpleRepr();
4197 static MEDCouplingMultiFields *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4199 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4200 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4202 std::vector<MEDCouplingFieldDouble *> fs(sz);
4203 for(int i=0;i<sz;i++)
4204 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4205 return MEDCouplingMultiFields::New(fs);
4207 MEDCouplingMultiFields(PyObject *li) throw(INTERP_KERNEL::Exception)
4209 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4210 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4212 std::vector<MEDCouplingFieldDouble *> fs(sz);
4213 for(int i=0;i<sz;i++)
4214 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4215 return MEDCouplingMultiFields::New(fs);
4217 PyObject *getFields() const
4219 std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
4220 int sz=fields.size();
4221 PyObject *res = PyList_New(sz);
4222 for(int i=0;i<sz;i++)
4226 fields[i]->incrRef();
4227 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(fields[i]),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
4231 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 ));
4236 PyObject *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
4238 const MEDCouplingFieldDouble *ret=self->getFieldAtPos(id);
4242 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
4245 return SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, 0 );
4247 PyObject *getMeshes() const throw(INTERP_KERNEL::Exception)
4249 std::vector<MEDCouplingMesh *> ms=self->getMeshes();
4251 PyObject *res = PyList_New(sz);
4252 for(int i=0;i<sz;i++)
4257 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4261 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4266 PyObject *getDifferentMeshes() const throw(INTERP_KERNEL::Exception)
4268 std::vector<int> refs;
4269 std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
4271 PyObject *res = PyList_New(sz);
4272 for(int i=0;i<sz;i++)
4277 PyList_SetItem(res,i,convertMesh(ms[i], SWIG_POINTER_OWN | 0 ));
4281 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh, 0 ));
4285 PyObject *ret=PyTuple_New(2);
4286 PyTuple_SetItem(ret,0,res);
4287 PyTuple_SetItem(ret,1,convertIntArrToPyList2(refs));
4290 PyObject *getArrays() const throw(INTERP_KERNEL::Exception)
4292 std::vector<DataArrayDouble *> ms=self->getArrays();
4294 PyObject *res = PyList_New(sz);
4295 for(int i=0;i<sz;i++)
4300 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4304 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4309 PyObject *getDifferentArrays() const throw(INTERP_KERNEL::Exception)
4311 std::vector< std::vector<int> > refs;
4312 std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
4314 PyObject *res = PyList_New(sz);
4315 PyObject *res2 = PyList_New(sz);
4316 for(int i=0;i<sz;i++)
4321 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(ms[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
4325 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 ));
4327 PyList_SetItem(res2,i,convertIntArrToPyList2(refs[i]));
4330 PyObject *ret=PyTuple_New(2);
4331 PyTuple_SetItem(ret,0,res);
4332 PyTuple_SetItem(ret,1,res2);
4338 class MEDCouplingDefinitionTime
4341 MEDCouplingDefinitionTime();
4342 void assign(const MEDCouplingDefinitionTime& other);
4343 bool isEqual(const MEDCouplingDefinitionTime& other) const;
4344 double getTimeResolution() const;
4345 std::vector<double> getHotSpotsTime() const;
4348 std::string __str__() const throw(INTERP_KERNEL::Exception)
4350 std::ostringstream oss;
4351 self->appendRepr(oss);
4355 PyObject *getIdsOnTimeRight(double tm) const throw(INTERP_KERNEL::Exception)
4357 int meshId,arrId,arrIdInField,fieldId;
4358 self->getIdsOnTimeRight(tm,meshId,arrId,arrIdInField,fieldId);
4359 PyObject *res=PyList_New(4);
4360 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4361 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4362 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4363 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4367 PyObject *getIdsOnTimeLeft(double tm) const throw(INTERP_KERNEL::Exception)
4369 int meshId,arrId,arrIdInField,fieldId;
4370 self->getIdsOnTimeLeft(tm,meshId,arrId,arrIdInField,fieldId);
4371 PyObject *res=PyList_New(4);
4372 PyList_SetItem(res,0,PyInt_FromLong(meshId));
4373 PyList_SetItem(res,1,PyInt_FromLong(arrId));
4374 PyList_SetItem(res,2,PyInt_FromLong(arrIdInField));
4375 PyList_SetItem(res,3,PyInt_FromLong(fieldId));
4381 class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
4384 double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
4385 MEDCouplingDefinitionTime getDefinitionTimeZone() const;
4389 MEDCouplingFieldOverTime(PyObject *li) throw(INTERP_KERNEL::Exception)
4391 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4392 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4394 std::vector<MEDCouplingFieldDouble *> fs(sz);
4395 for(int i=0;i<sz;i++)
4396 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4397 return MEDCouplingFieldOverTime::New(fs);
4399 std::string __str__() const throw(INTERP_KERNEL::Exception)
4401 return self->simpleRepr();
4403 static MEDCouplingFieldOverTime *New(PyObject *li) throw(INTERP_KERNEL::Exception)
4405 std::vector<const ParaMEDMEM::MEDCouplingFieldDouble *> tmp;
4406 convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
4408 std::vector<MEDCouplingFieldDouble *> fs(sz);
4409 for(int i=0;i<sz;i++)
4410 fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
4411 return MEDCouplingFieldOverTime::New(fs);
4419 __filename=os.environ.get('PYTHONSTARTUP')
4420 if __filename and os.path.isfile(__filename):
4421 execfile(__filename)