github.com/archlabjp/eeslism-go@v0.0.0-20231109122333-4bb7bfcdf292/eeslism/ERRPRINT.go (about) 1 //This file is part of EESLISM. 2 // 3 //Foobar is free software : you can redistribute itand /or modify 4 //it under the terms of the GNU General Public License as published by 5 //the Free Software Foundation, either version 3 of the License, or 6 //(at your option) any later version. 7 // 8 //Foobar is distributed in the hope that it will be useful, 9 //but WITHOUT ANY WARRANTY; without even the implied warranty of 10 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 11 //GNU General Public License for more details. 12 // 13 //You should have received a copy of the GNU General Public License 14 //along with Foobar.If not, see < https://www.gnu.org/licenses/>. 15 16 /* 17 18 出力ファイル作成 19 FILE=ERRPRINT.c 20 Create Date 1999.10.26 21 22 */ 23 24 package eeslism 25 26 import ( 27 "fmt" 28 "io" 29 "os" 30 ) 31 32 /*------計算中の面から見える面と見えない面を判別する際に必要となる 33 ベクトルの値を出力する-------------------------*/ 34 35 func errbekt_print(n, m int, a []bekt, name string) { 36 var i, j int 37 var fp *os.File 38 39 name += ".gchi" 40 41 fp, err := os.Create(name) 42 if err != nil { 43 fmt.Println("File not open errbektPrintf") 44 os.Exit(1) 45 } 46 47 fmt.Fprintf(fp, "%s ", name) 48 49 for i = 0; i < n; i++ { 50 for j = 0; j < m; j++ { 51 fmt.Fprintf(fp, "%f %f %f %f\n", a[i].ps[j][0], a[i].ps[j][1], a[i].ps[j][2], a[i].ps[j][3]) 52 } 53 } 54 fmt.Fprintf(fp, "\n") 55 fp.Close() 56 } 57 58 /*--形態係数の出力--*/ 59 func ffactor_printf(fp4 io.Writer, mpn, lpn int, mp, lp []P_MENN, Mon, Day int) { 60 var i, j, k int 61 62 k = mpn + lpn 63 64 fmt.Fprintf(fp4, "%d/%d\n", Mon, Day) 65 for i = 0; i < mpn; i++ { 66 fmt.Fprintf(fp4, "%s\nFAIA %f\nFAIG %f\n", mp[i].opname, mp[i].faia, mp[i].faig) 67 for j = 0; j < k; j++ { 68 if j < mpn && mp[i].faiwall[j] != 0.0 { 69 fmt.Fprintf(fp4, "%s %f\n", mp[j].opname, mp[i].faiwall[j]) 70 } else if j >= mpn && mp[i].faiwall[j] != 0.0 { 71 fmt.Fprintf(fp4, "%s %f\n", lp[j-mpn].opname, mp[i].faiwall[j]) 72 } 73 } 74 } 75 } 76 77 /*-----------法線ベクトルの出力-----------*/ 78 func e_printf(n int, p []P_MENN, name string) { 79 var i int 80 var fp *os.File 81 82 name += ".gchi" 83 84 fp, err := os.Create(name) 85 if err != nil { 86 fmt.Println("File not open ePrintf") 87 os.Exit(1) 88 } 89 90 for i = 0; i < n; i++ { 91 fmt.Fprintf(fp, "%d x=%f y=%f z=%f\n", i, p[i].e.X, p[i].e.Y, p[i].e.Z) 92 } 93 94 fp.Close() 95 } 96 97 /*---------------影面積の出力--------------------*/ 98 func shadow_printf(fp io.Writer, M, D int, mt float64, mpn int, mp []P_MENN) { 99 var i int 100 101 fmt.Fprintf(fp, "%d %d %5.2f", M, D, mt) 102 103 for i = 0; i < mpn; i++ { 104 fmt.Fprintf(fp, " %1.2f", mp[i].sum) 105 } 106 107 fmt.Fprintf(fp, "\n") 108 } 109 110 /*------MP面の情報出力----------------------*/ 111 func mp_printf(n int, mp []P_MENN, name string) { 112 var i int 113 var fp *os.File 114 115 name += ".gchi" 116 117 fp, err := os.Create(name) 118 if err != nil { 119 fmt.Println("File not open mpPrintf") 120 os.Exit(1) 121 } 122 123 for i = 0; i < n; i++ { 124 fmt.Fprintf(fp, "name=%s wlflg=%d\n", mp[i].opname, mp[i].wlflg) 125 fmt.Fprintf(fp, "mp[%d] wb=%f wa=%f ref=%f\n", i, mp[i].wb, mp[i].wa, mp[i].ref) 126 fmt.Fprintf(fp, " e.X=%f e.Y=%f e.Z=%f\n", mp[i].e.X, mp[i].e.Y, mp[i].e.Z) 127 fmt.Fprintf(fp, " grp.X=%f grp.Y=%f grp.Z=%f\n", mp[i].grp.X, mp[i].grp.Y, mp[i].grp.Z) 128 fmt.Fprintf(fp, " G.X=%f G.Y=%f G.Z=%f\n", mp[i].G.X, mp[i].G.Y, mp[i].G.Z) 129 fmt.Fprintf(fp, "\n") 130 } 131 132 fp.Close() 133 } 134 135 /*------MP面の前面地面のポイント座標出力---------------------*/ 136 func gp_printf(gp [][]XYZ, mp []P_MENN, mpn, lpn int, name string) { 137 var i, k int 138 var fp *os.File 139 140 name += ".gchi" 141 142 fp, err := os.Create(name) 143 if err != nil { 144 fmt.Println("File not open gpPrintf") 145 os.Exit(1) 146 } 147 148 for i = 0; i < mpn; i++ { 149 fmt.Fprintf(fp, "mp[%d] %s\n", i, mp[i].opname) 150 k = 0 151 for gp[i][k].X != -999 { 152 fmt.Fprintf(fp, "%d %f %f %f\n", k, gp[i][k].X, gp[i][k].Y, gp[i][k].Z) 153 k++ 154 } 155 } 156 157 fp.Close() 158 } 159 160 /*------LP面の情報出力---------------------------*/ 161 func lp_printf(n int, lp []P_MENN, name string) { 162 var i int 163 var fp *os.File 164 165 name += ".gchi" 166 167 fp, err := os.Create(name) 168 if err != nil { 169 fmt.Println("File not open lpPrintf") 170 os.Exit(1) 171 } 172 173 for i = 0; i < n; i++ { 174 fmt.Fprintf(fp, "mp[%d] wb=%f wa=%f ref=%f\n", i, lp[i].wb, lp[i].wa, lp[i].ref) 175 fmt.Fprintf(fp, " e.X=%f e.Y=%f e.Z=%f\n", lp[i].e.X, lp[i].e.Y, lp[i].e.Z) 176 fmt.Fprintf(fp, " G.X=%f G.Y=%f G.Z=%f\n", lp[i].G.X, lp[i].G.Y, lp[i].G.Z) 177 fmt.Fprintf(fp, "\n") 178 } 179 180 fp.Close() 181 } 182 183 /*--------------LP面毎の日射遮蔽率出力--------------*/ 184 func lp_shad_printf(lpn int, lp []P_MENN, name string) { 185 var fp *os.File 186 var i, j int 187 188 name += ".gchi" 189 190 fp, err := os.Create(name) 191 if err != nil { 192 fmt.Println("File not open lpShadPrintf") 193 os.Exit(1) 194 } 195 196 for i = 0; i < lpn; i++ { 197 fmt.Fprintf(fp, "%s ", lp[i].opname) 198 } 199 fmt.Fprintf(fp, "\n") 200 201 for i = 1; i <= 365; i++ { 202 for j = 0; j < lpn; j++ { 203 fmt.Fprintf(fp, "%f ", lp[j].shad[i]) 204 } 205 fmt.Fprintf(fp, "\n") 206 } 207 208 fp.Close() 209 }