oomph-convert.InputPoints Class Reference

Public Member Functions

def __init__ (self)
 

Static Public Member Functions

def parse (file, line, dim)
 

Public Attributes

 coordinates
 
 fields
 

Detailed Description

 This class handles Tecplot node informations.

Constructor & Destructor Documentation

◆ __init__()

def oomph-convert.InputPoints.__init__ (   self)
984  def __init__(self):
985  self.coordinates = [.0, .0, .0]
986  """ Node coordinates
987  """
988  self.fields = list()
989  """ Fields values
990  """
991 

Member Function Documentation

◆ parse()

def oomph-convert.InputPoints.parse (   file,
  line,
  dim 
)
static
993  def parse(file, line, dim):
994 
995 
996  #-----------------------------------------------------------------------
997  # Create the point
998  #-----------------------------------------------------------------------
999  point = InputPoints()
1000 
1001  #-----------------------------------------------------------------------
1002  # Seek to the next point
1003  #-----------------------------------------------------------------------
1004  while 1:
1005  pointline = file.readline()
1006  line += 1
1007 
1008  if not pointline:
1009  # We reach the end of the file
1010  return (None, line)
1011 
1012  # Boolean indicating that the line contains only numerical data
1013  is_fp_line=1
1014 
1015  #Read the line and split into individual entries
1016  values = list()
1017  values = pointline.strip().split(" ")
1018 
1019  # Check that all entries are floating points numbers
1020  for i, value in enumerate(values):
1021 
1022  # Define regular expression for floating point number
1023  float_point_re=re.compile('[-+]?[0-9]*\.?[0-9]*([e,E][-+]?[0-9]+)?')
1024 
1025  match_index=re.match(float_point_re,value)
1026  if match_index is not None:
1027  if len(match_index.group()) != len(value):
1028  is_fp_line=0
1029  break
1030  else:
1031  is_fp_line=0
1032  break
1033 
1034  # If it's a line containing only floating point numbers:
1035  # Extract coordinates and values
1036  if is_fp_line > 0:
1037  for i, value in enumerate(values):
1038  try:
1039  # Coordinate
1040  if i < dim:
1041  point.coordinates[i] = float(value)
1042  # Value
1043  else:
1044  point.fields.append(float(value))
1045  except ValueError:
1046  raise TecplotParsingError("Invalid zone", "wrong node values !", line)
1047 
1048  return (point, line)
1049 
1050 #
void split(const DoubleVector &in_vector, Vector< DoubleVector * > &out_vector_pt)
Definition: double_vector.cc:1413

References oomph::DoubleVectorHelpers.split().

Member Data Documentation

◆ coordinates

oomph-convert.InputPoints.coordinates

◆ fields

oomph-convert.InputPoints.fields

The documentation for this class was generated from the following file: