op2 Package

fortranFile Module

Inheritance diagram of pyNastran.op2.fortranFile
class pyNastran.op2.fortranFile.FortranFile[source]

Bases: object

getBlockIntEntry(data, n)[source]

given a data set, grabs the nth word and casts it as an integer

getData(n)[source]

gets a data set of length N

getDoubles(data)[source]

unpacks a data set into a series of doubles

getFloats(data)[source]

unpacks a data set into a series of floats

getFloats2(data, endian)[source]

unpacks a data set into a series of floats

getInts(data, debug=True)[source]

unpacks a data set into a series of ints

getInts2(data, endian, debug=True)[source]

unpacks a data set into a series of ints

getLongs(data)[source]

unpacks a data set into a series of longs

getMarker(expected=None, debug=True)[source]
getNMarkers(nMarkers, rewind=False)[source]

gets the next N markers, verifies they’re correct

getStrings(data)[source]

unpacks a data set into a series of characters

getStrings2(data, endian)[source]

unpacks a data set into a series of characters

getTableCode(expected=None, debug=True)[source]
goto(n)[source]

jumps to position n in the file

Parameters:
  • self – the object pointer
  • n – the position to goto

Note

n>0

hasMoreTables()[source]
isTableDone(expectedMarkers)[source]
printBlock(data, nMax=200)[source]

prints a data set in int/float/double/string format to determine table info. doesn’t move cursor.

Note

this is a great function for debugging

printBlock2(data, endian)[source]

prints a data set in int/float/double/string format to determine table info. doesn’t move cursor.

Note

this is a great function for debugging

printSection(nBytes)[source]

prints data, but doesn’t move the cursor

Parameters:
  • self – the object pointer
  • nBytes – the number of bytes to print the data specs on
Returns:

msg ints/floats/strings of the next nBytes (handles poorly sized nBytes; uncrashable :) )

Note

this the BEST function when adding new cards/tables/debugging

printSection2(nBytes, endian)[source]

prints data, but doesn’t move the cursor

Parameters:
  • self – the object pointer
  • nBytes – the number of bytes to print the data specs on
Returns:

msg ints/floats/strings of the next nBytes (handles poorly sized nBytes; uncrashable :) )

Note

this the BEST function when adding new cards/tables/debugging

readBlock()[source]

reads a fortran formatted data block nWords data1 data2 data3 nWords

readData(n)[source]
readDoubleBlock()[source]

reads a fortran formatted block assumes that the data is made up of doubles only

readDoubles(nData, debug=True)[source]

reads a list of nDoubles

Parameters:
  • self – the object pointer
  • nData – the number of doubles to read
  • debug – for developer: debug combined with makeOp2Debug
readFloatBlock()[source]

reads a fortran formatted block assumes that the data is made up of floats only

readFloats(nData, debug=True)[source]

reads nFloats

readFullBlock()[source]

reads a fortran formatted data block nWords data1 data2 data3 nWords includes nWords in the output

readFullIntBlock()[source]

reads a fortran formatted block assumes that the data is made up of integers only

readHeader(expected=None, debug=True)[source]

a header is defined as (4,i,4), where i is an integer

readHollerith()[source]

doesnt really read a hollerith, it’s an integer of value=528 which corresponds to the length of iTable=3

readIntBlock()[source]

reads a fortran formatted block assumes that the data is made up of integers only

readInts(nInts, debug=True)[source]

reads a list of nIntegers

Parameters:
  • self – the object pointer
  • nInts – the number of ints to read
  • debug – for developer: debug combined with makeOp2Debug
readMarker(expected=None)[source]
readMarkers(markers, tableName=None, debug=False, printErrorOnFailure=True)[source]

Reads a set of predefined markers e.g. [-3,1,0] and makes sure it is correct.

A marker (e.g. a -3) is a series of 3 integers [4,-3,4]. Typically 3 markers are put together (e.g. [-3,1,0]) such that the integers are [4,-3,4, 4,1,4, 4,0,4] to mark important parts of the table.

Markers will “increment” during table reading, such that the first marker is [-1,1,0], then [-2,1,0], etc. Tables will end (or really the next table starts) when a [-1,1,0] or a [0,1,0] marker is found.

# Verify the following statement... Occassionally, buffer markers will be embedded inside the marker [-3,1,0], (e.g. [4,2^16,4] <- the default BUFFSIZE), which make reading the marker more difficult.

readString(nData)[source]

reads nCharacters that are assumed to be a string

readStringBlock(debug=True)[source]

reads a fortran formatted block assumes that the data is made up of characters only

readTableName(rewind=True, debug=True, stopOnFailure=True)[source]

peeks into a table to check it’s name

rewind(n)[source]

rewinds the file nBytes

Warning

doesnt support a full rewind, only a partial

scan(n)[source]

same as skip, but actually reads the data instead of using seek

setEndian(endian=u'<')[source]

sets the endian

Todo

hasnt been implemented

skip(n)[source]

skips nBits

skipNextTable(bufferSize=10000)[source]

skips a table

Todo

fix bugs

op2 Module

op2Codes Module

Inheritance diagram of pyNastran.op2.op2Codes
class pyNastran.op2.op2Codes.Op2Codes[source]

Bases: object

ElementType(eCode)[source]
codeInformation()[source]

prints the general table information DMAP - page 60-63

isMagnitudePhase()[source]
isRandomResponse()[source]
isReal()[source]
isRealImaginary()[source]
isRealImaginaryOrMagnitudePhase()[source]
isRealOrRandom()[source]
isSort1()[source]
isSort2()[source]
isSortedResponse()[source]
isStress()[source]
isThermal()[source]
printTableCode(tableCode)[source]

op2_helper Module

Subpackages