Action_Thermostats
        Add_AtomRandomPerturbation
        Add_SelectAtomByNameAction
        Adding_Graph_to_ChangeBondActions
        Adding_MD_integration_tests
        Adding_StructOpt_integration_tests
        AutomationFragmentation_failures
        Candidate_v1.6.1
        Candidate_v1.7.0
        ChangeBugEmailaddress
        ChemicalSpaceEvaluator
        Docu_Python_wait
        EmpiricalPotential_contain_HomologyGraph_documentation
        Enhance_userguide
        Enhanced_StructuralOptimization
        Enhanced_StructuralOptimization_continued
        Example_ManyWaysToTranslateAtom
        Exclude_Hydrogens_annealWithBondGraph
        Fix_StepWorldTime_single_argument
        Fix_Verbose_Codepatterns
        ForceAnnealing_oldresults
        ForceAnnealing_with_BondGraph
        ForceAnnealing_with_BondGraph_continued
        ForceAnnealing_with_BondGraph_continued_betteresults
        ForceAnnealing_with_BondGraph_contraction-expansion
        Gui_displays_atomic_force_velocity
        IndependentFragmentGrids_IntegrationTest
        JobMarket_RobustOnKillsSegFaults
        JobMarket_StableWorkerPool
        PythonUI_with_named_parameters
        QtGui_reactivate_TimeChanged_changes
        Recreated_GuiChecks
        StoppableMakroAction
        TremoloParser_IncreasedPrecision
        TremoloParser_MultipleTimesteps
        stable
      
      
      
| Rev | Line |  | 
|---|
| [0b990d] | 1 | // | 
|---|
|  | 2 | // carray.h --- C Style Arrays | 
|---|
|  | 3 | // | 
|---|
|  | 4 |  | 
|---|
|  | 5 | #ifndef _util_container_carray_h | 
|---|
|  | 6 | #define _util_container_carray_h | 
|---|
|  | 7 |  | 
|---|
|  | 8 | namespace sc { | 
|---|
|  | 9 |  | 
|---|
|  | 10 | template <class T> | 
|---|
|  | 11 | T ** | 
|---|
|  | 12 | new_c_array2(int l, int m, T) | 
|---|
|  | 13 | { | 
|---|
|  | 14 | T *a = 0; | 
|---|
|  | 15 | T **b = 0; | 
|---|
|  | 16 | if (l*m) a = new T[l*m]; | 
|---|
|  | 17 | if (l) b = new T*[l]; | 
|---|
|  | 18 | for (int i=0; i<l; i++) b[i] = &a[i*m]; | 
|---|
|  | 19 | return b; | 
|---|
|  | 20 | } | 
|---|
|  | 21 |  | 
|---|
|  | 22 | template <class T> | 
|---|
|  | 23 | T ** | 
|---|
|  | 24 | new_zero_c_array2(int l, int m, T) | 
|---|
|  | 25 | { | 
|---|
|  | 26 | T *a = 0; | 
|---|
|  | 27 | T **b = 0; | 
|---|
|  | 28 | if (l*m) a = new T[l*m]; | 
|---|
|  | 29 | if (l) b = new T*[l]; | 
|---|
|  | 30 | for (int i=0; i<l; i++) { | 
|---|
|  | 31 | b[i] = &a[i*m]; | 
|---|
|  | 32 | for (int j=0; j<m; j++) { | 
|---|
|  | 33 | b[i][j] = 0; | 
|---|
|  | 34 | } | 
|---|
|  | 35 | } | 
|---|
|  | 36 | return b; | 
|---|
|  | 37 | } | 
|---|
|  | 38 |  | 
|---|
|  | 39 | template <class T> | 
|---|
|  | 40 | void | 
|---|
|  | 41 | delete_c_array2(T**b) | 
|---|
|  | 42 | { | 
|---|
|  | 43 | if (b) delete[] b[0]; | 
|---|
|  | 44 | delete[] b; | 
|---|
|  | 45 | } | 
|---|
|  | 46 |  | 
|---|
|  | 47 | template <class T> | 
|---|
|  | 48 | T *** | 
|---|
|  | 49 | new_c_array3(int l, int m, int n, T) | 
|---|
|  | 50 | { | 
|---|
|  | 51 | T *a = 0; | 
|---|
|  | 52 | T **b = 0; | 
|---|
|  | 53 | T ***c = 0; | 
|---|
|  | 54 | if (l*m*n) a = new T[l*m*n]; | 
|---|
|  | 55 | if (l*m) b = new T*[l*m]; | 
|---|
|  | 56 | if (l) c = new T**[l]; | 
|---|
|  | 57 | for (int i=0,ij=0; i<l; i++) { | 
|---|
|  | 58 | c[i] = &b[i*m]; | 
|---|
|  | 59 | for (int j=0; j<m; j++,ij++) { | 
|---|
|  | 60 | c[i][j] = &a[ij*n]; | 
|---|
|  | 61 | } | 
|---|
|  | 62 | } | 
|---|
|  | 63 | return c; | 
|---|
|  | 64 | } | 
|---|
|  | 65 |  | 
|---|
|  | 66 | template <class T> | 
|---|
|  | 67 | T *** | 
|---|
|  | 68 | new_zero_c_array3(int l, int m, int n, T) | 
|---|
|  | 69 | { | 
|---|
|  | 70 | T *a = 0; | 
|---|
|  | 71 | T **b = 0; | 
|---|
|  | 72 | T ***c = 0; | 
|---|
|  | 73 | if (l*m*n) a = new T[l*m*n]; | 
|---|
|  | 74 | if (l*m) b = new T*[l*m]; | 
|---|
|  | 75 | if (l) c = new T**[l]; | 
|---|
|  | 76 | for (int i=0,ij=0; i<l; i++) { | 
|---|
|  | 77 | c[i] = &b[i*m]; | 
|---|
|  | 78 | for (int j=0; j<m; j++,ij++) { | 
|---|
|  | 79 | c[i][j] = &a[ij*n]; | 
|---|
|  | 80 | for (int k=0; k<n; k++) { | 
|---|
|  | 81 | c[i][j][k] = 0; | 
|---|
|  | 82 | } | 
|---|
|  | 83 | } | 
|---|
|  | 84 | } | 
|---|
|  | 85 | return c; | 
|---|
|  | 86 | } | 
|---|
|  | 87 |  | 
|---|
|  | 88 | template <class T> | 
|---|
|  | 89 | void | 
|---|
|  | 90 | delete_c_array3(T***b) | 
|---|
|  | 91 | { | 
|---|
|  | 92 | if (b && b[0]) delete[] b[0][0]; | 
|---|
|  | 93 | if (b) delete[] b[0]; | 
|---|
|  | 94 | delete[] b; | 
|---|
|  | 95 | } | 
|---|
|  | 96 |  | 
|---|
|  | 97 | } | 
|---|
|  | 98 |  | 
|---|
|  | 99 | #endif | 
|---|
|  | 100 |  | 
|---|
|  | 101 | // /////////////////////////////////////////////////////////////////////////// | 
|---|
|  | 102 |  | 
|---|
|  | 103 | // Local Variables: | 
|---|
|  | 104 | // mode: c++ | 
|---|
|  | 105 | // c-file-style: "CLJ" | 
|---|
|  | 106 | // End: | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.