67 using namespace MEDCoupling;
74 const DoubleTab& xv = zvf.
xv();
79 Cerr <<
"ERROR : Champ_front_calc_interne::completer() - number of faces of the internal boundary is not even!"<< finl;
82 face_map_.resize(nbfaces,RESIZE_OPTIONS::NOCOPY_NOINIT);
87 MCAuto<DataArrayDouble> coo(DataArrayDouble::New());
88 coo->alloc(nbfaces, ndim);
90 for (
int i = 0; i < nbfaces; i++)
94 for (
int d = 0; d < ndim; d++)
95 coo->setIJSilent(i, d, xv(num_f, d));
98 DataArrayIdType *cP, *cIP;
100 int nb_faces_dup = (int)cP->getNumberOfTuples();
101 if (nb_faces_dup == nbfaces)
104 MCAuto<DataArrayIdType> dsi(cIP->deltaShiftIndex());
106 if (!dsi->isUniform(2))
108 Cerr <<
"ERROR : Problem on internal boundary. Some face(s) not duplicated." << finl;
112 const mcIdType *p(cP->begin());
113 for (
int i = 0; i < nbfaces / 2; i++, p += 2)
115 int pi1 = (int)(*p), pi2 = (int)(*(p+1));
125 MCAuto<DataArrayDouble> fnorm(DataArrayDouble::New());
126 fnorm->alloc(nbfaces, 1);
127 fnorm->fillWithZero();
129 double* pfnorm = fnorm->getPointer();
131 for (
int i = 0; i < nbfaces; i++)
135 for (
int d = 0; d < ndim; d++)
138 coo->setIJSilent(i, d, xv(num_f, d));
140 pfnorm[i]/=face_surfaces(num_f);
145 MCAuto<DataArrayIdType> Idpos = fnorm->findIdsInRange(1-eps,1+eps);
146 MCAuto<DataArrayIdType> Idneg = fnorm->findIdsInRange(-1-eps,-1+eps);
148 mcIdType n1 = Idpos->getNumberOfTuples();
149 mcIdType n2 = Idneg->getNumberOfTuples();
151 if ((n1!=n2) || (n1+n2)!=nbfaces)
153 Cerr <<
"ERROR : Problem on internal boundary. Cannot associate pairs of faces." << finl;
156 MCAuto<DataArrayDouble> coo_pos = coo->selectByTupleId(*Idpos);
157 MCAuto<DataArrayDouble> coo_neg = coo->selectByTupleId(*Idneg);
159 const mcIdType* pIdpos = Idpos->getConstPointer();
160 const mcIdType* pIdneg = Idneg->getConstPointer();
162 MCAuto<DataArrayIdType> idx = coo_pos->findClosestTupleId(coo_neg);
164 const mcIdType* pidx = idx->getConstPointer();
166 for (
int i=0; i<nbfaces/2; i++)
168 int j2 = (int)pIdneg[i];
169 int k = (int)pidx[i];
170 int j1 = (int)pIdpos[k];
virtual const DoubleVect & face_surfaces() const
virtual double face_normales(int face, int comp) const
double xv(int num_face, int k) const