Swarm-NG  1.1
swarmng.logrecord Namespace Reference

Contains the support functions for accessing the C++ logrecord data strcture. More...

Classes

class  LogRecord
 Data structure equivalent of the logrecord defined in Swarm-NG C++ library This class does not use any C++ code, intead it uses pack/unpack to directly parse the binary format into Python variables. More...
 

Functions

def center_of_mass
 Compute the physical center of mass (weighted average of properties by mass) of an array of planets. More...
 
def with_index
 Take a list and return a new iterable that yields elements from the original list with indices.
 

Detailed Description

Contains the support functions for accessing the C++ logrecord data strcture.

Function Documentation

def swarmng.logrecord.center_of_mass (   bodies)

Compute the physical center of mass (weighted average of properties by mass) of an array of planets.

  • bodies : an array of structure [((x,y,z),(vx,vy,vz),mass),...]

Returns a tuple of structure ((x,y,z),(vx,vy,vz),mass), where x,y,z,vx,vy,vz are weighted average of the corresponding attributes in orginial array. mass is the sum of all mass.

Definition at line 21 of file logrecord.py.

Referenced by swarmng.logrecord.LogRecord.barycenter(), and swarmng.logrecord.LogRecord.bodies_in_keplerian_jacobi().