#include "xyz2shc.h" int XYZ2SHC::OutShc(char* filename){ int start_index,flow_index; ofstream outfile; if (open_outfile(outfile,filename)) return -1; for (int i = 0; i < shc_order_+1; i++){ //按列优先排列将球谐系数输出 由列号计算数组中的起始位置 start_index = int(0.5*i*(2*shc_order_+3-i)); for (int j = 0; j < shc_order_+1; j++){ //根据行号计算偏移量 flow_index = j - i; outfile << j << " " << i << setprecision(16) << " " << shc_value_[start_index+flow_index] << " " << shc_value_[start_index+flow_index+half_shc_num_] << endl; } } outfile.close(); return 0; }