MCPcopy Create free account
hub / github.com/KLayout/klayout / set_complex

Method set_complex

src/db/db/dbArray.h:2640–2693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2638 }
2639
2640 void set_complex (double mag, double rcos, const array<Obj, Trans> &d)
2641 {
2642 basic_array <coord_type> *new_base = 0;
2643
2644 // if we finally have a complex transformation, set a new base object
2645 if (fabs (mag - 1.0) > epsilon || fabs (rcos - 1.0) > epsilon) {
2646
2647 // create a new base object with the transformed base vectors
2648 vector_type a, b;
2649 unsigned long amax, bmax;
2650 bool is_reg = d.is_regular_array (a, b, amax, bmax);
2651
2652 std::vector<vector_type> v;
2653 bool is_iterated = d.is_iterated_array (&v);
2654
2655 if (is_reg) {
2656 new_base = new regular_complex_array <coord_type> (rcos, mag, a, b, amax, bmax);
2657 } else if (is_iterated) {
2658 new_base = new iterated_complex_array <coord_type> (rcos, mag, v.begin (), v.end ());
2659 } else {
2660 new_base = new single_complex_inst <coord_type> (rcos, mag);
2661 }
2662
2663 } else if (d.is_complex ()) {
2664
2665 // create a new base object with the transformed base vectors
2666 vector_type a, b;
2667 unsigned long amax, bmax;
2668 bool is_reg = d.is_regular_array (a, b, amax, bmax);
2669
2670 std::vector<vector_type> v;
2671 bool is_iterated = d.is_iterated_array (&v);
2672
2673 if (is_reg) {
2674 new_base = new regular_array <coord_type> (a, b, amax, bmax);
2675 } else if (is_iterated) {
2676 new_base = new iterated_array <coord_type> (v.begin (), v.end ());
2677 } else {
2678 // a complex transformation delegate is no longer required
2679 if (mp_base && ! mp_base->in_repository) {
2680 delete mp_base;
2681 }
2682 mp_base = 0;
2683 }
2684
2685 }
2686
2687 if (new_base) {
2688 if (mp_base && ! mp_base->in_repository) {
2689 delete mp_base;
2690 }
2691 mp_base = new_base;
2692 }
2693 }
2694
2695 template <class T>
2696 void transform_delegate (const T &tr, db::ArrayRepository *array_rep)

Callers

nothing calls this directly

Calls 5

is_regular_arrayMethod · 0.45
is_iterated_arrayMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
is_complexMethod · 0.45

Tested by

no test coverage detected