Documentation ¶
Index ¶
- Constants
- Variables
- func ConstraintGroupExpr(groupName string) string
- func CreateFile(filePath string) *os.File
- func EnsureParseDOF(dofString string, context string) (int, int, int)
- func EnsureParseFloat(stringValue string, context string) float64
- func EnsureParseInt(stringValue string, context string) int
- func EnsureParseTorsor(torsorString string, context string) *math.Torsor
- func ExtractNamedGroups(re *regexp.Regexp, str string) map[string]string
- func FloatGroupExpr(groupName string) string
- func IdGroupExpr(groupName string) string
- func IsDefinitionFile(path string) bool
- func IsPreprocessedFile(path string) bool
- func IsSectionHeaderLine(line string) bool
- func MakeTestDefinitionReader() io.Reader
- func MakeTestDefinitionReaderInverseOrder() io.Reader
- func MakeTestOriginalStructure() *structure.Structure
- func MakeTestPreprocessedReader() io.Reader
- func MakeTestPreprocessedStructure() *preprocess.Structure
- func MakeTestSolution() *process.Solution
- func NameGroupExpr(groupName string) string
- func OpenFile(filePath string) *os.File
- func ParseMetadata(linesReader *LinesReader) structure.StrMetadata
- func ParseSectionHeader(line string) string
- func ParseVersionNumbers(versionString string) (majorVersion, minorVersion int)
- func ShouldIgnoreLine(line string) bool
- func TorsorGroupExpr(groupName string) string
- type LinesReader
- type ReaderOptions
Constants ¶
const ( OptionalSpaceExpr = `\s*` SpaceExpr = `\s+` NameGrpName = "name" NameGrpExpr = `'(?P<` + NameGrpName + `>` + validNameExpr + `)'` IdGrpName = "id" IdGrpExpr = `(?P<` + IdGrpName + `>` + validIDExpr + `)` ArrowExpr = `\s*->\s*` LoadTermExpr = `(?P<term>[fm]{1}[xyz]{1})\s+` LoadElementID = `(?P<element>` + validIDExpr + `)\s+` DistributedLoadRefExpr = `(?P<ref>[lg]{1})d\s+` ConcentratedLoadRefExpr = `(?P<ref>[lg]{1})c\s+` DofGrpName = "dof" DofGrpExpr = `(?P<` + DofGrpName + `>\[\d+ \d+ \d+\])` )
const DefinitionFileExt = ".inkfem"
DefinitionFileExt is the extension of the structure definition files.
const PreFileExt = ".inkfempre"
PreFileExt is the extension of the preprocessed structure files.
const SolFileExt = ".inkfemsol"
SolFileExt is the extension of the solved structure files.
Variables ¶
var ( NodesHeader = "nodes" MaterialsHeader = "materials" SectionsHeader = "sections" LoadsHeader = "loads" BarsHeader = "bars" )
Functions ¶
func ConstraintGroupExpr ¶
func CreateFile ¶
CreateFile returns a new open file to be writen to. Panics if the file can't be created. Don't forget to close the file.
func EnsureParseDOF ¶
EnsureParseDOF attempts to parse three degrees of freedom given the format: [%d %d %d]. Panics if the operation fails. The "context" is used as part of the panic message and it refers to the name of the number being parsed.
func EnsureParseFloat ¶
EnsureParseFloat attempts to parse a floating point number from the given string and panics if the operation fails. The "context" is used as part of the panic message and it refers to the name of the number being parsed.
func EnsureParseInt ¶
EnsureParseInt attempts to parse a floating point number from the given string and panics if the operation fails. The "context" is used as part of the panic message and it refers to the name of the number being parsed.
func EnsureParseTorsor ¶
EnsureParseTorsor attempts to parse a torsor given it's string form: {%f %f %f}. Panics if the operation fails. The "context" is used as part of the panic message and it refers to the name of the number being parsed.
func ExtractNamedGroups ¶
ExtractNamedGroups returns a map of matches by group id. Panics if the given string doesn't match the regular expression.
func FloatGroupExpr ¶
func IdGroupExpr ¶
func IsDefinitionFile ¶
IsDefinitionFile returns true if the file extension in the path is .inkfem.
func IsPreprocessedFile ¶
IsPreprocessedFile returns true if the file extension in the path is .inkfempre.
func IsSectionHeaderLine ¶
func MakeTestPreprocessedStructure ¶
func MakeTestPreprocessedStructure() *preprocess.Structure
func MakeTestSolution ¶
func NameGroupExpr ¶
func OpenFile ¶
OpenFile returns an existing file to be writen to. Panics if the file can't be opened. Don't forget to close the file.
func ParseMetadata ¶
func ParseMetadata(linesReader *LinesReader) structure.StrMetadata
ParseMetadata reads the structure metadata from the structure files first line: "inkfem vM.m". Panics if the first line doesn't follow the expected format.
func ParseSectionHeader ¶
func ParseVersionNumbers ¶
ParseVersionNumbers expectes the passed in string to follow the format "inkfem vM.m" where "M" and "m" are the major and minor versions of the application. It returns these two version numbers or panics if the line couldn't be matched.
func ShouldIgnoreLine ¶
ShouldIgnoreLine decides whether a given line can be ignored. A line can be ignored if, after removing the surrounding white space, it's empty or starts with "#", the comment opener.
func TorsorGroupExpr ¶
Types ¶
type LinesReader ¶
type LinesReader struct {
// contains filtered or unexported fields
}
A LinesReader reads lines from a buffered scanner one by one, ignoring blank and commented lines. All returned lines are trimmed to remove the blank space around them.
func MakeLinesReader ¶
func MakeLinesReader(reader io.Reader) *LinesReader
MakeLinesReader creates a lines using the passed in reader.
func (*LinesReader) GetNextLine ¶
func (lr *LinesReader) GetNextLine() string
GetNextLine returns the next line read by the ReadNext method.
func (*LinesReader) GetNextLineNumber ¶
func (lr *LinesReader) GetNextLineNumber() int
GetNextLineNumber returns the next line number read by the ReadNext method.
func (*LinesReader) GetNextLines ¶
func (lr *LinesReader) GetNextLines(count int) []string
GetNextLines gets the next "count" lines from the reader, ignoring comments and blank lines. Panics if there're not enough lines left in the reader.
func (*LinesReader) ReadNext ¶
func (lr *LinesReader) ReadNext() bool
ReadNext checks if there are more lines available and reads the next one. If HasMoreLines returns "true", GetNextLine and GetNextLineNumber can be called to get the next line and its original line number.
type ReaderOptions ¶
type ReaderOptions struct {
ShouldIncludeOwnWeight bool
}