libatomprobe
Library for Atom Probe Tomography (APT) computation
multiplesplit.cpp
Go to the documentation of this file.
1 #include "atomprobe/atomprobe.h"
2 
3 using namespace std;
4 using namespace AtomProbe;
5 
6 int main(int argc ,char *argv[])
7 {
8 
9  if((argc !=4 && argc !=3))
10  {
11  cerr << "USAGE: EPOSFILE POSFILE_OUT_SINGLE [POSFILE_OUT_MULT]" << endl;
12  return 1;
13  }
14 
15  bool singlesOnly = (argc ==3);
16 
17  std::vector<EPOS_ENTRY> outData;
18 
19  //Load the EPOS file
20  if(loadEposFile(outData, argv[1]))
21  {
22  cerr << "Epos file load failed. File is :" << argv[2] << endl;
23  return 1;
24  }
25 
26  vector<IonHit> singleData, multipleData;
27 
28  for(auto &hit : outData)
29  {
30  if(hit.hitMultiplicity == 1)
31  singleData.push_back(hit.getIonHit());
32  else
33  multipleData.push_back(hit.getIonHit());
34  }
35  outData.clear();
36  outData.shrink_to_fit();
37 
38 
39  cerr << "Number of singles is :" << singleData.size()<< endl;
40  cerr << "Number of multiples is :" << multipleData.size()<< endl;
41 
42  if(savePosFile(singleData,argv[2]))
43  {
44  cerr << "Error saving multiple hits to :" << argv[2] << endl;
45  return 1;
46  }
47 
48  if(!singlesOnly)
49  {
50  if(savePosFile(multipleData,argv[3]))
51  {
52  cerr << "Error saving single hits to :" << argv[3] << endl;
53  return 1;
54  }
55  }
56 
57 }
int main(int argc, char *argv[])
STL namespace.
size_t loadEposFile(std::vector< EPOS_ENTRY > &outData, const char *filename)
Load an entire "EPOS" File.
Definition: dataFiles.cpp:756
unsigned int savePosFile(const std::vector< Point3D > &points, float mass, const char *name, bool append=false)
Save a vector of Point3Ds into a pos file, using a fixed mass, return nonzero on error.
Definition: dataFiles.cpp:499