int main(void) { P_CODE_INSTALL_SEH char username[20]; // key for KOrUPt is 4559164 unsigned int eax, edx; unsigned long dwReturnAddress; printf("In main()\n"); // test nesting functiona calls P_CODE_START printf("1st call\n"); N1(); P_CODE_END printf("Repeating\n"); P_CODE_START printf("1st call\n"); N1(); P_CODE_END printf("\nNested call test complete\n"); P_CODE_UNINSTALL_SEH return 0; }
void Mda::setChunk(Mda& X, bigint i1, bigint i2, bigint i3) { bigint size1 = X.N1(); bigint size2 = X.N2(); bigint size3 = X.N3(); bigint a1_begin = i1; bigint x1_begin = 0; bigint a1_end = i1 + size1 - 1; bigint x1_end = size1 - 1; if (a1_begin < 0) { a1_begin += 0 - a1_begin; x1_begin += 0 - a1_begin; } if (a1_end >= N1()) { a1_end += N1() - 1 - a1_end; x1_end += N1() - 1 - a1_end; } bigint a2_begin = i2; bigint x2_begin = 0; bigint a2_end = i2 + size2 - 1; bigint x2_end = size2 - 1; if (a2_begin < 0) { a2_begin += 0 - a2_begin; x2_begin += 0 - a2_begin; } if (a2_end >= N2()) { a2_end += N2() - 1 - a2_end; x2_end += N2() - 1 - a2_end; } bigint a3_begin = i3; bigint x3_begin = 0; bigint a3_end = i3 + size3 - 1; bigint x3_end = size3 - 1; if (a3_begin < 0) { a2_begin += 0 - a3_begin; x3_begin += 0 - a3_begin; } if (a3_end >= N3()) { a3_end += N3() - 1 - a3_end; x3_end += N3() - 1 - a3_end; } double* ptr1 = this->dataPtr(); double* ptr2 = X.dataPtr(); for (bigint ind3 = 0; ind3 <= a3_end - a3_begin; ind3++) { for (bigint ind2 = 0; ind2 <= a2_end - a2_begin; ind2++) { bigint ii_out = (ind2 + x2_begin) * size1 + (ind3 + x3_begin) * size1 * size2; bigint ii_in = (ind2 + a2_begin) * N1() + (ind3 + a3_begin) * N1() * N2(); for (bigint ind1 = 0; ind1 <= a1_end - a1_begin; ind1++) { ptr1[ii_in] = ptr2[ii_out]; ii_in++; ii_out++; } } } }
void Mda::getChunk(Mda& ret, bigint i1, bigint i2, bigint i3, bigint size1, bigint size2, bigint size3) const { // A lot of bugs fixed on 5/31/16 bigint a1_begin = i1; bigint x1_begin = 0; bigint a1_end = i1 + size1 - 1; bigint x1_end = size1 - 1; if (a1_begin < 0) { x1_begin += 0 - a1_begin; a1_begin += 0 - a1_begin; } if (a1_end >= N1()) { x1_end += N1() - 1 - a1_end; a1_end += N1() - 1 - a1_end; } bigint a2_begin = i2; bigint x2_begin = 0; bigint a2_end = i2 + size2 - 1; bigint x2_end = size2 - 1; if (a2_begin < 0) { x2_begin += 0 - a2_begin; a2_begin += 0 - a2_begin; } if (a2_end >= N2()) { x2_end += N2() - 1 - a2_end; a2_end += N2() - 1 - a2_end; } bigint a3_begin = i3; bigint x3_begin = 0; bigint a3_end = i3 + size3 - 1; bigint x3_end = size3 - 1; if (a3_begin < 0) { x3_begin += 0 - a3_begin; a3_begin += 0 - a3_begin; } if (a3_end >= N3()) { x3_end += N3() - 1 - a3_end; a3_end += N3() - 1 - a3_end; } ret.allocate(size1, size2, size3); const double* ptr1 = this->constDataPtr(); double* ptr2 = ret.dataPtr(); for (bigint ind3 = 0; ind3 <= a3_end - a3_begin; ind3++) { for (bigint ind2 = 0; ind2 <= a2_end - a2_begin; ind2++) { bigint ii_out = x1_begin + (ind2 + x2_begin) * size1 + (ind3 + x3_begin) * size1 * size2; //bug fixed on 5/31/16 by jfm bigint ii_in = a1_begin + (ind2 + a2_begin) * N1() + (ind3 + a3_begin) * N1() * N2(); //bug fixed on 5/31/16 by jfm for (bigint ind1 = 0; ind1 <= a1_end - a1_begin; ind1++) { ptr2[ii_out] = ptr1[ii_in]; ii_in++; ii_out++; } } } }
double* Mda::dataPtr(bigint i1, bigint i2, bigint i3, bigint i4, bigint i5, bigint i6) { const bigint N12 = N1() * N2(); const bigint N13 = N12 * N3(); const bigint N14 = N13 * N4(); const bigint N15 = N14 * N5(); return d->data() + (i1 + N1() * i2 + N12 * i3 + N13 * i4 + N14 * i5 + N15 * i6); }
int main(){ TTableContext Context; // create scheme Schema AnimalS; AnimalS.Add(TPair<TStr,TAttrType>("Animal", atStr)); AnimalS.Add(TPair<TStr,TAttrType>("Size", atStr)); AnimalS.Add(TPair<TStr,TAttrType>("Location", atStr)); AnimalS.Add(TPair<TStr,TAttrType>("Number", atInt)); TIntV RelevantCols; RelevantCols.Add(0); RelevantCols.Add(1); RelevantCols.Add(2); // create table PTable T = TTable::LoadSS("Animals", AnimalS, "tests/animals.txt", Context, RelevantCols); //PTable T = TTable::LoadSS("Animals", AnimalS, "animals.txt"); T->Unique("Animal"); TTable Ts = *T; // did we fix problem with copy-c'tor ? //PTable Ts = TTable::LoadSS("Animals_s", AnimalS, "../../testfiles/animals.txt", RelevantCols); //Ts->Unique(AnimalUnique); // test Select // create predicate tree: find all animals that are big and african or medium and Australian TPredicate::TAtomicPredicate A1(atStr, true, EQ, "Location", "", 0, 0, "Africa"); TPredicate::TPredicateNode N1(A1); // Location == "Africa" TPredicate::TAtomicPredicate A2(atStr, true, EQ, "Size", "", 0, 0, "big"); TPredicate::TPredicateNode N2(A2); // Size == "big" TPredicate::TPredicateNode N3(AND); N3.AddLeftChild(&N1); N3.AddRightChild(&N2); TPredicate::TAtomicPredicate A4(atStr, true, EQ, "Location", "", 0, 0, "Australia"); TPredicate::TPredicateNode N4(A4); TPredicate::TAtomicPredicate A5(atStr, true, EQ, "Size", "", 0, 0, "medium"); TPredicate::TPredicateNode N5(A5); TPredicate::TPredicateNode N6(AND); N6.AddLeftChild(&N4); N6.AddRightChild(&N5); TPredicate::TPredicateNode N7(OR); N7.AddLeftChild(&N3); N7.AddRightChild(&N6); TPredicate Pred(&N7); TIntV SelectedRows; Ts.Select(Pred, SelectedRows); TStrV GroupBy; GroupBy.Add("Location"); T->Group(GroupBy, "LocationGroup"); GroupBy.Add("Size"); T->Group(GroupBy, "LocationSizeGroup"); T->Count("LocationCount", "Location"); PTable Tj = T->Join("Location", Ts, "Location"); TStrV UniqueAnimals; UniqueAnimals.Add("Animals_1.Animal"); UniqueAnimals.Add("Animals_2.Animal"); Tj->Unique(UniqueAnimals, false); //print table T->SaveSS("tests/animals_out_T.txt"); Ts.SaveSS("tests/animals_out_Ts.txt"); Tj->SaveSS("tests/animals_out_Tj.txt"); return 0; }
bool Mda::write64(const char* path) const { if (QString(path).endsWith(".txt")) { return d->write_to_text_file(path, ' '); } if (QString(path).endsWith(".csv")) { return d->write_to_text_file(path, ','); } FILE* output_file = fopen(path, "wb"); if (!output_file) { printf("Warning: Unable to open mda file for writing: %s\n", path); return false; } MDAIO_HEADER H; H.data_type = MDAIO_TYPE_FLOAT64; H.num_bytes_per_entry = 4; for (int i = 0; i < MDAIO_MAX_DIMS; i++) H.dims[i] = 1; for (int i = 0; i < MDA_MAX_DIMS; i++) H.dims[i] = d->dims(i); H.num_dims = d->determine_num_dims(N1(), N2(), N3(), N4(), N5(), N6()); mda_write_header(&H, output_file); mda_write_float64((double*)d->constData(), &H, d->totalSize(), output_file); d->incrementBytesWrittenCounter(d->totalSize() * H.num_bytes_per_entry); fclose(output_file); return true; }
int main() { std::string nameT1 = "TG4037N21.txt"; std::string nameT2 = "TG4037N22_matched.txt"; NeuronStruct N1( nameT1.c_str() ); NeuronStruct N2( nameT2.c_str() ); std::cout<<N1.getNeuronSize()<<'\n'; std::cout<<N2.getNeuronSize()<<'\n'; std::vector< std::pair<int, double> > nonOverlapVarations; N1.NonOverlapVariation( N2, nonOverlapVarations); double sum = N1.getNeuronSize(); for(int i=0; i<nonOverlapVarations.size(); ++i) { sum += nonOverlapVarations[i].second; } std::cout<<"Total Length N1 + sum( variations ) = "<<sum<<'\n'; nonOverlapVarations.clear(); N2.NonOverlapVariation( N1, nonOverlapVarations); sum = N2.getNeuronSize(); for(int i=0; i<nonOverlapVarations.size(); ++i) { sum += nonOverlapVarations[i].second; } std::cout<<"Total Length N2 + sum( variations ) = "<<sum<<'\n'; return 0; }
result_type operator()(A0& yi, A1& inputs) const { yi.resize(inputs.extent()); const child0 & x = boost::proto::child_c<0>(inputs); if (numel(x) <= 1) BOOST_ASSERT_MSG(numel(x) > 1, "Interpolation requires at least two sample points in each dimension."); else { BOOST_ASSERT_MSG(issorted(x, 'a'), "for 'nearest' interpolation x values must be sorted in ascending order"); const child1 & y = boost::proto::child_c<1>(inputs); BOOST_ASSERT_MSG(numel(x) == numel(y), "The grid vectors do not define a grid of points that match the given values."); const child2 & xi = boost::proto::child_c<2>(inputs); bool extrap = false; value_type extrapval = Nan<value_type>(); choices(inputs, extrap, extrapval, N1()); table<index_type> index = bsearch (x, xi); table<value_type> dx = xi-x(index); table<index_type> indexp1 = oneplus(index); yi = y(nt2::if_else(lt(nt2::abs(xi-x(index)), nt2::abs(xi-x(indexp1))), index, indexp1)); value_type b = value_type(x(begin_)); value_type e = value_type(x(end_)); if (!extrap) yi = nt2::if_else(nt2::logical_or(boost::simd::is_nge(xi, b), boost::simd::is_nle(xi, e)), extrapval, yi); } return yi; }
int main() { Nef_polyhedron N1(Sphere_circle(1,0,0)); Nef_polyhedron N2(Sphere_circle(0,1,0), Nef_polyhedron::EXCLUDED); Nef_polyhedron N3 = N1 * N2; return 0; }
void ViewmdaModel::setC1(int i) { if (m_d1<0) return; if (C1()==i) return; if ((i<0)||(i>=N1())) return; m_current_index[m_d1]=i; emit currentIndexChanged(); }
BOOST_FORCEINLINE result_type operator()( A0& a0, A1& a1 ) const { // Copy data in output first x_type x = boost::proto::child_c<0>(a0); y_type y = boost::proto::child_c<1>(a0); size_t l = lval(a0, N0()); polcoefs(a1, x, y, l, N1()); }
bool evclm(uint32 e,uint32 N, XLong& result) { XLong e1(0,result.GetBitLength()); e1 = e; XLong N1(0,result.GetBitLength()); N1 = N; return (evclm(e1,N1,result)); }
void Mda32::getChunk(Mda32& ret, bigint i1, bigint i2, bigint size1, bigint size2) const { // A lot of bugs fixed on 5/31/16 bigint a1_begin = i1; bigint x1_begin = 0; bigint a1_end = i1 + size1 - 1; bigint x1_end = size1 - 1; if (a1_begin < 0) { x1_begin += 0 - a1_begin; a1_begin += 0 - a1_begin; } if (a1_end >= N1()) { x1_end += N1() - 1 - a1_end; a1_end += N1() - 1 - a1_end; } bigint a2_begin = i2; bigint x2_begin = 0; bigint a2_end = i2 + size2 - 1; bigint x2_end = size2 - 1; if (a2_begin < 0) { x2_begin += 0 - a2_begin; a2_begin += 0 - a2_begin; } if (a2_end >= N2()) { x2_end += N2() - 1 - a2_end; a2_end += N2() - 1 - a2_end; } ret.allocate(size1, size2); const float* ptr1 = this->constDataPtr(); float* ptr2 = ret.dataPtr(); for (bigint ind2 = 0; ind2 <= a2_end - a2_begin; ind2++) { bigint ii_out = (ind2 + x2_begin) * size1 + x1_begin; //bug fixed on 5/31/16 by jfm bigint ii_in = (ind2 + a2_begin) * N1() + a1_begin; //bug fixed on 5/31/16 by jfm for (bigint ind1 = 0; ind1 <= a1_end - a1_begin; ind1++) { ptr2[ii_out] = ptr1[ii_in]; ii_in++; ii_out++; } } }
void Mda32::setChunk(Mda32& X, bigint i1, bigint i2) { bigint size1 = X.N1(); bigint size2 = X.N2(); bigint a1_begin = i1; bigint x1_begin = 0; bigint a1_end = i1 + size1 - 1; bigint x1_end = size1 - 1; if (a1_begin < 0) { a1_begin += 0 - a1_begin; x1_begin += 0 - a1_begin; } if (a1_end >= N1()) { a1_end += N1() - 1 - a1_end; x1_end += N1() - 1 - a1_end; } bigint a2_begin = i2; bigint x2_begin = 0; bigint a2_end = i2 + size2 - 1; bigint x2_end = size2 - 1; if (a2_begin < 0) { a2_begin += 0 - a2_begin; x2_begin += 0 - a2_begin; } if (a2_end >= N2()) { a2_end += N2() - 1 - a2_end; x2_end += N2() - 1 - a2_end; } dtype32* ptr1 = this->dataPtr(); dtype32* ptr2 = X.dataPtr(); for (bigint ind2 = 0; ind2 <= a2_end - a2_begin; ind2++) { bigint ii_out = (ind2 + x2_begin) * size1; bigint ii_in = (ind2 + a2_begin) * N1(); for (bigint ind1 = 0; ind1 <= a1_end - a1_begin; ind1++) { ptr1[ii_in] = ptr2[ii_out]; ii_in++; ii_out++; } } }
int main() { // Primary Operators AnnihilationOperator A1(0); // 1st freedom NumberOperator N1(0); IdentityOperator Id1(0); AnnihilationOperator A2(1); // 2nd freedom NumberOperator N2(1); IdentityOperator Id2(1); SigmaPlus Sp(2); // 3rd freedom IdentityOperator Id3(2); Operator Sm = Sp.hc(); // Hermitian conjugate Operator Ac1 = A1.hc(); Operator Ac2 = A2.hc(); // Hamiltonian double E = 20.0; double chi = 0.4; double omega = -0.7; double eta = 0.001; Complex I(0.0,1.0); Operator H = (E*I)*(Ac1-A1) + (0.5*chi*I)*(Ac1*Ac1*A2 - A1*A1*Ac2) + omega*Sp*Sm + (eta*I)*(A2*Sp-Ac2*Sm); // Lindblad operators double gamma1 = 1.0; double gamma2 = 1.0; double kappa = 0.1; const int nL = 3; Operator L[nL]={sqrt(2*gamma1)*A1,sqrt(2*gamma2)*A2,sqrt(2*kappa)*Sm}; // Initial state State phi1(50,FIELD); // see paper Section 4.2 State phi2(50,FIELD); State phi3(2,SPIN); State stateList[3] = {phi1,phi2,phi3}; State psiIni(3,stateList); // Trajectory double dt = 0.01; // basic time step int numdts = 100; // time interval between outputs = numdts*dt int numsteps = 5; // total integration time = numsteps*numdts*dt int nOfMovingFreedoms = 2; double epsilon = 0.01; // cutoff probability int nPad = 2; // pad size //ACG gen(38388389); // random number generator with seed //ComplexNormal rndm(&gen); // Complex Gaussian random numbers ComplexNormalTest rndm(899101); // Simple portable random number generator AdaptiveStep stepper(psiIni, H, nL, L); // see paper Section 5 // Output const int nOfOut = 3; Operator outlist[nOfOut]={ Sp*A2*Sm*Sp, Sm*Sp*A2*Sm, A2 }; char *flist[nOfOut]={"X1.out","X2.out","A2.out"}; int pipe[] = {1,5,9,11}; // controls standard output (see `onespin.cc') // Simulate one trajectory (for several trajectories see `onespin.cc') Trajectory traj(psiIni, dt, stepper, &rndm); // see paper Section 5 traj.plotExp( nOfOut, outlist, flist, pipe, numdts, numsteps, nOfMovingFreedoms, epsilon, nPad ); }
int Curvature2DAngleF0D::operator()(Interface0DIterator& iter) { Interface0DIterator tmp1 = iter, tmp2 = iter; ++tmp2; unsigned count = 1; while ((!tmp1.isBegin()) && (count < 3)) { --tmp1; ++count; } while ((!tmp2.isEnd()) && (count < 3)) { ++tmp2; ++count; } if (count < 3) { // if we only have 2 vertices result = 0; return 0; } Interface0DIterator v = iter; if (iter.isBegin()) ++v; Interface0DIterator next = v; ++next; if (next.isEnd()) { next = v; --v; } Interface0DIterator prev = v; --prev; Vec2r A(prev->getProjectedX(), prev->getProjectedY()); Vec2r B(v->getProjectedX(), v->getProjectedY()); Vec2r C(next->getProjectedX(), next->getProjectedY()); Vec2r AB(B - A); Vec2r BC(C - B); Vec2r N1(-AB[1], AB[0]); if (N1.norm() != 0) N1.normalize(); Vec2r N2(-BC[1], BC[0]); if (N2.norm() != 0) N2.normalize(); if ((N1.norm() == 0) && (N2.norm() == 0)) { Exception::raiseException(); result = 0; return -1; } double cosin = N1 * N2; if (cosin > 1) cosin = 1; if (cosin < -1) cosin = -1; result = acos(cosin); return 0; }
bool Mda::reshape(bigint N1b, bigint N2b, bigint N3b, bigint N4b, bigint N5b, bigint N6b) { if (N1b * N2b * N3b * N4b * N5b * N6b != this->totalSize()) { qWarning() << "Unable to reshape Mda, wrong total size"; qWarning() << N1b << N2b << N3b << N4b << N5b << N6b; qWarning() << N1() << N2() << N3() << N4() << N5() << N6(); return false; } d->setDims(N1b, N2b, N3b, N4b, N5b, N6b); return true; }
pointField quadrilateralDistribution::evaluate() { // Read needed material label N0( readLabel(pointDict_.lookup("N0")) ); label N1( readLabel(pointDict_.lookup("N1")) ); point xs0( pointDict_.lookup("linestart0") ); point xe0( pointDict_.lookup("lineend0") ); point xe1( pointDict_.lookup("lineend1") ); scalar stretch0( pointDict_.lookupOrDefault<scalar>("stretch0", 1.0) ); scalar stretch1( pointDict_.lookupOrDefault<scalar>("stretch1", 1.0) ); // Define the return field pointField res(N0*N1, xs0); // Compute the scaling factor scalar factor0(0.0); scalar factor1(0.0); for (int i=1; i < N0; i++) { factor0 += Foam::pow( stretch0, static_cast<scalar>(i) ); } for (int i=1; i < N1; i++) { factor1 += Foam::pow( stretch1, static_cast<scalar>(i) ); } point dx0( (xe0 - xs0)/factor0 ); point dx1( (xe1 - xs0)/factor1 ); // Compute points for (int j=0; j < N1; j++) { if (j != 0) { res[j*N0] = res[(j - 1)*N0] + Foam::pow( stretch1, static_cast<scalar>(j))*dx1; } for (int i=1; i < N0; i++) { res[i + j*N0] = res[i - 1 + j*N0] + Foam::pow( stretch0, static_cast<scalar>(i) )*dx0; } } return res; }
void Element::polarDecompositionEigen( const ColumnMajorMatrix & Fhat, ColumnMajorMatrix & Rhat, SymmTensor & strain_increment ) { const int ND = 3; ColumnMajorMatrix eigen_value(ND,1), eigen_vector(ND,ND); ColumnMajorMatrix invUhat(ND,ND), logVhat(ND,ND); ColumnMajorMatrix n1(ND,1), n2(ND,1), n3(ND,1), N1(ND,1), N2(ND,1), N3(ND,1); ColumnMajorMatrix Chat = Fhat.transpose() * Fhat; Chat.eigen(eigen_value,eigen_vector); for(int i = 0; i < ND; i++) { N1(i) = eigen_vector(i,0); N2(i) = eigen_vector(i,1); N3(i) = eigen_vector(i,2); } const Real lamda1 = std::sqrt(eigen_value(0)); const Real lamda2 = std::sqrt(eigen_value(1)); const Real lamda3 = std::sqrt(eigen_value(2)); const Real log1 = std::log(lamda1); const Real log2 = std::log(lamda2); const Real log3 = std::log(lamda3); ColumnMajorMatrix Uhat = N1 * N1.transpose() * lamda1 + N2 * N2.transpose() * lamda2 + N3 * N3.transpose() * lamda3; invertMatrix(Uhat,invUhat); Rhat = Fhat * invUhat; strain_increment = N1 * N1.transpose() * log1 + N2 * N2.transpose() * log2 + N3 * N3.transpose() * log3; }
void ViewmdaModel::autoSetWindows() { float minval=0,maxval=0; bool first=true; for (qint32 x=0; x<N1(); x++) for (qint32 y=0; y<N2(); y++) { real val=abs(get(x,y)); if ((first)||(val<minval)) minval=val; if ((first)||(val>maxval)) maxval=val; first=false; } m_window_min=0; m_window_max=maxval*1.2F; emit windowsChanged(); }
real CurvePoint::curvature2d_as_angle() const { #if 0 Vec3r edgeA = (_FEdges[0])->orientation2d(); Vec3r edgeB = (_FEdges[1])->orientation2d(); Vec2d N1(-edgeA.y(), edgeA.x()); N1.normalize(); Vec2d N2(-edgeB.y(), edgeB.x()); N2.normalize(); return acos((N1 * N2)); #endif if (__A == 0) return __B->curvature2d_as_angle(); if (__B == 0) return __A->curvature2d_as_angle(); return ((1 - _t2d) * __A->curvature2d_as_angle() + _t2d * __B->curvature2d_as_angle()); }
int main() { Nef_polyhedron N1(Nef_polyhedron::COMPLETE); Line l(2,4,2); // l : 2x + 4y + 2 = 0 Nef_polyhedron N2(l,Nef_polyhedron::INCLUDED); Nef_polyhedron N3 = N2.complement(); CGAL_assertion(N1 == N2.join(N3)); Point p1(0,0), p2(10,10), p3(-20,15); Point triangle[3] = { p1, p2, p3 }; Nef_polyhedron N4(triangle, triangle+3); Nef_polyhedron N5 = N2.intersection(N4); CGAL_assertion(N5 <= N2 && N5 <= N4); return 0; }
int main() { Nef_polyhedron N1(Plane_3( 1, 0, 0,-1),Nef_polyhedron::INCLUDED); Nef_polyhedron N2(Plane_3(-1, 0, 0,-1),Nef_polyhedron::INCLUDED); Nef_polyhedron N3(Plane_3( 0, 1, 0,-1),Nef_polyhedron::INCLUDED); Nef_polyhedron N4(Plane_3( 0,-1, 0,-1),Nef_polyhedron::INCLUDED); Nef_polyhedron N5(Plane_3( 0, 0, 1,-1),Nef_polyhedron::INCLUDED); Nef_polyhedron N6(Plane_3( 0, 0,-1,-1),Nef_polyhedron::INCLUDED); Nef_polyhedron I1(!N1+!N2); Nef_polyhedron I2(N3-!N4); Nef_polyhedron I3(N5^N6); Nef_polyhedron Cube1(I2 *!I1); Cube1 *= !I3; Nef_polyhedron Cube2 = N1 * N2 * N3 * N4 * N5 * N6; CGAL_assertion (Cube1 == Cube2); return 0; }
int main() { Nef_polyhedron N1(Plane_3(2,5,7,11), Nef_polyhedron::INCLUDED); Nef_polyhedron N2(Plane_3(2,5,7,11), Nef_polyhedron::EXCLUDED); CGAL_assertion(N1 >= N2); CGAL_assertion(N2 <= N1); CGAL_assertion(N1 != N2); CGAL_assertion(N1 > N2); CGAL_assertion(N2 < N1); N2 = N2.closure(); CGAL_assertion(N1==N2); CGAL_assertion(N1>=N2); CGAL_assertion(N1<=N2); return 0; }
int main() { Nef_polyhedron N1(Nef_polyhedron::COMPLETE); Sphere_circle c(1,1,1); // c : x + y + z = 0 Nef_polyhedron N2(c, Nef_polyhedron::INCLUDED); Nef_polyhedron N3(N2.complement()); CGAL_assertion(N1 == N2.join(N3)); Sphere_point p1(1,0,0), p2(0,1,0), p3(0,0,1); Sphere_segment s1(p1,p2), s2(p2,p3), s3(p3,p1); Sphere_segment triangle[3] = { s1, s2, s3 }; Nef_polyhedron N4(triangle, triangle+3); Nef_polyhedron N5; N5 += N2; N5 = N5.intersection(N4); CGAL_assertion(N5 <= N2 && N5 != N4); return 0; }
bool Mda::write16ui(const QString& path) const { FILE* output_file = fopen(path.toLatin1().data(), "wb"); if (!output_file) { printf("Warning: Unable to open mda file for writing: %s\n", path.toLatin1().data()); return false; } MDAIO_HEADER H; H.data_type = MDAIO_TYPE_UINT16; H.num_bytes_per_entry = 2; for (int i = 0; i < MDAIO_MAX_DIMS; i++) H.dims[i] = 1; for (int i = 0; i < MDA_MAX_DIMS; i++) H.dims[i] = d->dims(i); H.num_dims = d->determine_num_dims(N1(), N2(), N3(), N4(), N5(), N6()); mda_write_header(&H, output_file); mda_write_float64((double*)d->constData(), &H, d->totalSize(), output_file); d->incrementBytesWrittenCounter(d->totalSize() * H.num_bytes_per_entry); fclose(output_file); return true; }
int main() { const int N = 1000; const unsigned int K = 10; Tree tree; Random_points_iterator rpit(4,1000.0); for(int i = 0; i < N; i++){ tree.insert(*rpit++); } Point_d pp(0.1,0.1,0.1,0.1); Point_d qq(0.2,0.2,0.2,0.2); Iso_box_d query(pp,qq); Distance tr_dist; Neighbor_search N1(tree, query, 5, 10.0, false); // eps=10.0, nearest=false std::cout << "For query rectangle = [0.1, 0.2]^4 " << std::endl << "the " << K << " approximate furthest neighbors are: " << std::endl; for (Neighbor_search::iterator it = N1.begin();it != N1.end();it++) { std::cout << " Point " << it->first << " at distance " << tr_dist.inverse_of_transformed_distance(it->second) << std::endl; } return 0; }
int main() { Nef_polyhedron N0; Nef_polyhedron N1(Nef_polyhedron::EMPTY); Nef_polyhedron N2(Nef_polyhedron::COMPLETE); Nef_polyhedron N3(Plane_3( 1, 2, 5,-1)); Nef_polyhedron N4(Plane_3( 1, 2, 5,-1), Nef_polyhedron::INCLUDED); Nef_polyhedron N5(Plane_3( 1, 2, 5,-1), Nef_polyhedron::EXCLUDED); CGAL_assertion(N0 == N1); CGAL_assertion(N3 == N4); CGAL_assertion(N0 != N2); CGAL_assertion(N3 != N5); CGAL_assertion(N4 >= N5); CGAL_assertion(N5 <= N4); CGAL_assertion(N4 > N5); CGAL_assertion(N5 < N4); N5 = N5.closure(); CGAL_assertion(N4 >= N5); CGAL_assertion(N4 <= N5); return 0; }
double* Mda::dataPtr(bigint i1, bigint i2, bigint i3) { return d->data() + (i1 + N1() * i2 + N1() * N2() * i3); }
double* Mda::dataPtr(bigint i1, bigint i2) { return d->data() + (i1 + N1() * i2); }