int main(void) { TensorStructure s1(3,"ab"); TensorStructure s2(3,"b"); const Mesh m(IPoint(MV::fill,2,2)); Tensor<DataMesh> t1(s2,m,0.0); // will initialize all elements to zero Tensor<Tensor<DataMesh> > tt1(s1, t1); // will be a tensor of tensors, with all elements being zero Tensor<Tensor<DataMesh> > tt2(s1,s2, m, 0.0); // this gives the same result std::cout << "tt2(1,2)="<<tt2(1,2) <<"\n"; // will print out a Tensor<DataMesh> std::cout << "tt2(1,2)(0)="<<tt2(1,2)(0) <<"\n"; // will print out a single DatMesh // tt2(1,2) = 15; // will fail to compile tt2(1,2) = t1; // this is fine tt2(1,2)(0) = -3; // will be fine. return EXIT_SUCCESS; }
dgInt32 FastRayTest::BoxTestSimd (const dgVector& minBox, const dgVector& maxBox) const { simd_128 boxP0 ((simd_128&)minBox); simd_128 boxP1 ((simd_128&)maxBox); simd_128 tt0 (((simd_128&)m_p0 <= boxP0) | ((simd_128&)m_p0 >= boxP1) & (simd_128&)m_isParallel); if (tt0.GetSignMask() & 0x07) { return 0; } tt0 = (boxP0 - (simd_128&)m_p0) * (simd_128&)m_dpInv; simd_128 tt1 ((boxP1 - (simd_128&)m_p0) * (simd_128&)m_dpInv); simd_128 t0 (((simd_128&)m_minT).GetMax(tt0.GetMin(tt1))); simd_128 t1 (((simd_128&)m_maxT).GetMin(tt0.GetMax(tt1))); t0 = t0.GetMax(t0.ShiftTripleRight()); t1 = t1.GetMin(t1.ShiftTripleRight()); t0 = t0.GetMax(t0.ShiftTripleRight()); t1 = t1.GetMin(t1.ShiftTripleRight()); return ((t0 < t1).GetSignMask() & 1); }
// Main int main(int argc, char *argv[]) { // Init GTK Gtk::Main kit(argc, argv); Gtk::Window window; window.set_size_request(450, 350); Gtk::Fixed fixed; window.add(fixed); // Lines //////// Lines lines; lines.set_size_request(500, 425); // FLTK lines.add_line(230, 45, 110, 115); lines.add_line(270, 45, 270, 90); lines.add_line(290, 45, 400, 165); lines.add_line(310, 40, 350, 60); // Point lines.add_line(110, 55, 110, 115); lines.add_line(150, 55, 210, 90); // Graph lines.add_line(110, 160, 90, 240); lines.add_line(110, 160, 170, 340); // Window lines.add_line(250, 135, 230, 190); lines.add_line(270, 135, 270, 265); lines.add_line(320, 135, 400, 165); // GUI lines.add_line(340, 210, 270, 265); lines.add_line(390, 210, 400, 240); // Simple lines.add_line(200, 310, 170, 340); // So difficult... >.< fixed.add(lines); // Nodes //////// TitledText tt1("Point.h", "struct Point { ... };"); fixed.put(tt1, 50, 25); TitledText tt2("Graph.h", "// graphing interface\nstruct Shape { ... };\n..."); fixed.put(tt2, 50, 100); TitledText tt3("Graph.cpp", "Graph code"); fixed.put(tt3, 25, 225); TitledText tt4("Window.h", "// window interface\nclass Window { ... };\n..."); fixed.put(tt4, 200, 75); TitledText tt5("Window.cpp", "Window code"); fixed.put(tt5, 150, 175); TitledText tt6("GUI.h", "// GUI interface\nstruct In_box { ... };\n..."); fixed.put(tt6, 325, 150); TitledText tt7("GUI.cpp", "GUI code"); fixed.put(tt7, 350, 225); TitledText tt8("Simple_window.h", "// window interface\nclass Simple_window { ... };\n..."); fixed.put(tt8, 175, 250); TitledText tt9("chapter12.cpp", "#include \"Graph.h\"\n#include \"Simple_window.h\"\nint main { ... }"); fixed.put(tt9, 75, 325); FramedText ft1("FLTK headers"); ShadowFrame<FramedText> sfa1(ft1); ShadowFrame<ShadowFrame<FramedText> > sfb1(sfa1, 2); fixed.put(sfb1, 225, 25); FramedText ft2("FLTK code"); ShadowFrame<FramedText> sfa2(ft2); ShadowFrame<ShadowFrame<FramedText> > sfb2(sfa2, 2); fixed.put(sfb2, 350, 50); // Done, run the application window.show_all_children(); Gtk::Main::run(window); return EXIT_SUCCESS; }