Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
vlsvextract.cpp File Reference
#include <iostream>
#include <limits>
#include <stdint.h>
#include <cmath>
#include <list>
#include <sstream>
#include <dirent.h>
#include <stdio.h>
#include <unordered_set>
#include <vlsv_reader.h>
#include <vlsv_writer.h>
#include <vlsv_amr.h>
#include <boost/program_options.hpp>
#include <Eigen/Dense>
#include <phiprof.hpp>
#include "vlsv_util.h"
#include "vlsvreaderinterface.h"
#include "vlsvextract.h"
Include dependency graph for vlsvextract.cpp:

Go to the source code of this file.

Functions

uint64_t convUInt (const char *ptr, const datatype::type &dataType, const uint64_t &dataSize)
bool convertSlicedVelocityMesh (vlsvinterface::Reader &vlsvReader, const string &fname, const string &meshName, CellStructure &cellStruct, const std::string &popName)
void applyTranslation (const Real *V_bulk, Real *transform)
void applyRotation (const Real *B, Real *transform)
void getBulkVelocity (Real *V_bulk, vlsvinterface::Reader &vlsvReader, const string &meshName, const string &popName, const uint64_t &cellID)
void getB (Real *B, vlsvinterface::Reader &vlsvReader, const string &meshName, const uint64_t &cellID)
bool convertVelocityBlocks2 (vlsvinterface::Reader &vlsvReader, const string &fname, const string &meshName, CellStructure &cellStruct, const uint64_t &cellID, const bool rotate, const bool plasmaFrame, vlsv::Writer &out, const std::string &popName)
template<class T>
bool createCellIdList (T &vlsvReader, unordered_set< uint64_t > &cellIdList)
bool convertVelocityBlocks2 (vlsvinterface::Reader &vlsvReader, const string &fname, const string &meshName, CellStructure &cellStruct, const uint64_t &cellID, const bool rotate, const bool plasmaFrame)
void getCellCoordinates (const CellStructure &cellStruct, const uint64_t cellId, Real *coordinates)
uint64_t searchForBestCellId (const CellStructure &cellStruct, const uint64_t *cellIdList, const Real *coordinates, const uint64_t sizeOfCellIdList)
uint64_t searchForBestCellId (const CellStructure &cellStruct, const unordered_set< uint64_t > &cellIdList, const std::array< Real, 3 > coordinates)
bool setVelocityMeshVariables (vlsv::Reader &vlsvReader, CellStructure &cellStruct)
bool setVelocityMeshVariables (vlsv::Reader &vlsvReader, CellStructure &cellStruct, const std::string &popName)
bool setSpatialCellVariables (Reader &vlsvReader, CellStructure &cellStruct)
uint64_t getCellIdFromCoords (const CellStructure &cellStruct, const unordered_set< uint64_t > cellIdList, const std::array< Real, 3 > coords)
void printUsageMessage ()
bool retrieveOptions (const int argn, char *args[], UserOptions &mainOptions)
void setCoordinatesAlongALine (const CellStructure &cellStruct, const std::array< Real, 3 > &start, const std::array< Real, 3 > &end, uint32_t numberOfCoordinates, std::vector< std::array< Real, 3 > > &outputCoordinates)
template<class T>
void extractDistribution (const string &fileName, const UserOptions &mainOptions)
int main (int argn, char *args[])

Variables

static bool runDebug = false

Function Documentation

◆ applyRotation()

void applyRotation ( const Real * B,
Real * transform )

Definition at line 372 of file vlsvextract.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyTranslation()

void applyTranslation ( const Real * V_bulk,
Real * transform )

Definition at line 347 of file vlsvextract.cpp.

Here is the caller graph for this function:

◆ convertSlicedVelocityMesh()

bool convertSlicedVelocityMesh ( vlsvinterface::Reader & vlsvReader,
const string & fname,
const string & meshName,
CellStructure & cellStruct,
const std::string & popName )

Definition at line 107 of file vlsvextract.cpp.

Here is the call graph for this function:

◆ convertVelocityBlocks2() [1/2]

bool convertVelocityBlocks2 ( vlsvinterface::Reader & vlsvReader,
const string & fname,
const string & meshName,
CellStructure & cellStruct,
const uint64_t & cellID,
const bool rotate,
const bool plasmaFrame )

Driver function for convertVelocityBlocks. Reads the names of existing particle species and calls convertVelocityBlocks2 for each of them.

Parameters
vlsvReaderVLSV file reader that has input file open.
fnameName of the input file.
meshNameName of the spatial mesh.
cellStructStruct containing mesh metadata.
cellIDID of the spatial cell whose distribution function(s) are to be extracted.
rotateIf true, distribution function(s) are rotated so that the magnetic field points along +vz axis.
plasmaFrameIf true, distribution function(s) are translated to local plasma rest frame.
Returns
If true, all distributions were extracted successfully.

Definition at line 1058 of file vlsvextract.cpp.

Here is the call graph for this function:

◆ convertVelocityBlocks2() [2/2]

bool convertVelocityBlocks2 ( vlsvinterface::Reader & vlsvReader,
const string & fname,
const string & meshName,
CellStructure & cellStruct,
const uint64_t & cellID,
const bool rotate,
const bool plasmaFrame,
vlsv::Writer & out,
const std::string & popName )

Definition at line 727 of file vlsvextract.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convUInt()

uint64_t convUInt ( const char * ptr,
const datatype::type & dataType,
const uint64_t & dataSize )

Definition at line 84 of file vlsvextract.cpp.

◆ createCellIdList()

template<class T>
bool createCellIdList ( T & vlsvReader,
unordered_set< uint64_t > & cellIdList )

Definition at line 992 of file vlsvextract.cpp.

Here is the caller graph for this function:

◆ extractDistribution()

template<class T>
void extractDistribution ( const string & fileName,
const UserOptions & mainOptions )

Definition at line 1805 of file vlsvextract.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getB()

void getB ( Real * B,
vlsvinterface::Reader & vlsvReader,
const string & meshName,
const uint64_t & cellID )

Definition at line 563 of file vlsvextract.cpp.

Here is the caller graph for this function:

◆ getBulkVelocity()

void getBulkVelocity ( Real * V_bulk,
vlsvinterface::Reader & vlsvReader,
const string & meshName,
const string & popName,
const uint64_t & cellID )

Definition at line 450 of file vlsvextract.cpp.

Here is the caller graph for this function:

◆ getCellCoordinates()

void getCellCoordinates ( const CellStructure & cellStruct,
const uint64_t cellId,
Real * coordinates )

Definition at line 1109 of file vlsvextract.cpp.

Here is the caller graph for this function:

◆ getCellIdFromCoords()

uint64_t getCellIdFromCoords ( const CellStructure & cellStruct,
const unordered_set< uint64_t > cellIdList,
const std::array< Real, 3 > coords )

Definition at line 1465 of file vlsvextract.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int argn,
char * args[] )

Definition at line 1988 of file vlsvextract.cpp.

Here is the call graph for this function:

◆ printUsageMessage()

void printUsageMessage ( )

Definition at line 1499 of file vlsvextract.cpp.

Here is the caller graph for this function:

◆ retrieveOptions()

bool retrieveOptions ( const int argn,
char * args[],
UserOptions & mainOptions )

Definition at line 1513 of file vlsvextract.cpp.

Here is the caller graph for this function:

◆ searchForBestCellId() [1/2]

uint64_t searchForBestCellId ( const CellStructure & cellStruct,
const uint64_t * cellIdList,
const Real * coordinates,
const uint64_t sizeOfCellIdList )

Definition at line 1142 of file vlsvextract.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ searchForBestCellId() [2/2]

uint64_t searchForBestCellId ( const CellStructure & cellStruct,
const unordered_set< uint64_t > & cellIdList,
const std::array< Real, 3 > coordinates )

Definition at line 1189 of file vlsvextract.cpp.

Here is the call graph for this function:

◆ setCoordinatesAlongALine()

void setCoordinatesAlongALine ( const CellStructure & cellStruct,
const std::array< Real, 3 > & start,
const std::array< Real, 3 > & end,
uint32_t numberOfCoordinates,
std::vector< std::array< Real, 3 > > & outputCoordinates )

Definition at line 1734 of file vlsvextract.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSpatialCellVariables()

bool setSpatialCellVariables ( Reader & vlsvReader,
CellStructure & cellStruct )

Set correct spatial mesh variables to cellStruct. This function leaves the velocity mesh-related variables untouched.

Parameters
vlsvReaderVLSV file reader with input file open.
cellStructStruct where spatial mesh variables are written.
Returns
If true, spatial mesh variables were read successfully.

Definition at line 1396 of file vlsvextract.cpp.

Here is the caller graph for this function:

◆ setVelocityMeshVariables() [1/2]

bool setVelocityMeshVariables ( vlsv::Reader & vlsvReader,
CellStructure & cellStruct )

Read velocity mesh metadata from older Vlasiator VLSV files.

Parameters
vlsvReaderVLSV reader that has input file open.
cellStructStruct where read metadata is written.
Returns
If true, metadata was read successfully.

Definition at line 1228 of file vlsvextract.cpp.

Here is the caller graph for this function:

◆ setVelocityMeshVariables() [2/2]

bool setVelocityMeshVariables ( vlsv::Reader & vlsvReader,
CellStructure & cellStruct,
const std::string & popName )

Read velocity mesh metadata for the given particle species.

Parameters
vlsvReaderVLSV reader that has input file open.
cellStructStruct where read metadata is written.
popNameName of the particle species.
Returns
If true, metadata was read successfully.

Definition at line 1304 of file vlsvextract.cpp.

Variable Documentation

◆ runDebug

bool runDebug = false
static

Definition at line 52 of file vlsvextract.cpp.