-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoommf_test.cpp
42 lines (40 loc) · 1.98 KB
/
oommf_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "busybox.hpp"
#include "oommf.hpp"
#include "files.hpp"
#include "lib-zlib.hpp"
#include "text.hpp"
#include "vf.hpp"
int oommf_test_main(int argc,char **argv){
std::vector<unsigned char> buffer,data,dic,zdic,vf,outbuffer;
std::map<std::string,std::string> meta;
rcl::ffield field,fieldt;
rcl::load_file(buffer,"/home/ricardo/m_full000000.ovf.gz");
rcl::inflate(data,buffer,true);
rcl::loadOVF2v(field,data);
for (auto itr=field.getmeta().begin();itr!=field.getmeta().end();itr++)
std::cout << "# (" << itr->first << "): [" << itr->second <<"]"<< std::endl;
rcl::dump(dic,field.getmeta());
rcl::dump(meta,dic);
std::cout << "--------------------------------------------------------------------" << std::endl;
rcl::deflate(zdic,dic,false);
std::cout << "dic size = " << dic.size() << " : zdic size = " << zdic.size() << std::endl;
std::cout << "nodes ="<< field.getnodes().x() << ","
<< field.getnodes().y() << ","
<< field.getnodes().z() << std::endl;
std::cout << "csize ="<< field.getsize().x() << ","
<< field.getsize().y() << ","
<< field.getsize().z() << std::endl;
std::cout << "--------------------------------------------------------------------" << std::endl;
for (auto itr=meta.begin();itr!=meta.end();itr++)
std::cout << "# " << itr->first << ": " << itr->second << std::endl;
rcl::encode_vf(vf,field);
rcl::decode_vf(fieldt,vf);
rcl::saveOVF2vm(outbuffer,fieldt);
std::cout << "--------------------------------------------------------------------" << std::endl;
std::cout << "VF size = "<< vf.size() << std::endl;
std::cout << "OVF size = "<< buffer.size() << ":" << data.size() << " , " << outbuffer.size() << std::endl;
std::cout << "--------------------------------------------------------------------" << std::endl;
rcl::save_file("magnetizacion.ovf",outbuffer);
return 0;
}
static rcl::reg_app reg("oommf_test",oommf_test_main);