feat(cpp-object-oriented-modular-refactoring): step 6 - io-application-google-style
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#ifndef FESA_IO_ABAQUS_DOMAIN_MAPPER_H_
|
||||
#define FESA_IO_ABAQUS_DOMAIN_MAPPER_H_
|
||||
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/io/abaqus/input_syntax.h"
|
||||
#include "fesa/model/domain.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
/// @brief Maps syntax-only blocks into an approved immutable semantic model.
|
||||
/// @note Source identity and declaration order are preserved through mapping.
|
||||
class AbaqusDomainMapper {
|
||||
public:
|
||||
/// @brief Resolves supported Abaqus syntax into a complete Domain candidate.
|
||||
/// @param input Parsed syntax whose source locations remain valid for
|
||||
/// mapping.
|
||||
/// @return A committed Domain or structured input/model diagnostics; partial
|
||||
/// domains are never returned.
|
||||
Result<Domain> Map(const ParsedInput& input) const;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_IO_ABAQUS_DOMAIN_MAPPER_H_
|
||||
@@ -1,15 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/io/abaqus/input_syntax.hpp"
|
||||
#include "fesa/model/domain.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
// Converts syntax-only blocks into the approved immutable B33 semantic model.
|
||||
class AbaqusDomainMapper {
|
||||
public:
|
||||
Result<Domain> map(const ParsedInput& input) const;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef FESA_IO_ABAQUS_INPUT_READER_H_
|
||||
#define FESA_IO_ABAQUS_INPUT_READER_H_
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/io/abaqus/input_syntax.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
/// @brief Reads Abaqus physical keyword, data, and comment syntax.
|
||||
/// @note Semantic policy is applied later by AbaqusDomainMapper.
|
||||
class AbaqusInputReader {
|
||||
public:
|
||||
/// @brief Parses one input file without applying semantic mapping policy.
|
||||
/// @param input_path Path to the exact source bytes whose identity is
|
||||
/// retained.
|
||||
/// @return Parsed syntax or a structured input diagnostic.
|
||||
Result<ParsedInput> Read(const std::filesystem::path& input_path) const;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_IO_ABAQUS_INPUT_READER_H_
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/io/abaqus/input_syntax.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace fesa {
|
||||
|
||||
// Reads only physical keyword/data/comment syntax; semantic policy is applied
|
||||
// later by AbaqusDomainMapper.
|
||||
class AbaqusInputReader {
|
||||
public:
|
||||
Result<ParsedInput> read(const std::filesystem::path& inputPath) const;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef FESA_IO_ABAQUS_INPUT_SYNTAX_H_
|
||||
#define FESA_IO_ABAQUS_INPUT_SYNTAX_H_
|
||||
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "fesa/core/source_identity.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
/// @brief Stores a canonical parameter name and its optional source value.
|
||||
/// @note Parameter names are canonicalized for lookup while values remain
|
||||
/// source text.
|
||||
struct KeywordParameter {
|
||||
std::string name;
|
||||
std::optional<std::string> value;
|
||||
};
|
||||
|
||||
/// @brief Stores one parsed data row with its source location.
|
||||
struct DataLine {
|
||||
std::vector<std::string> fields;
|
||||
SourceLocation location;
|
||||
};
|
||||
|
||||
/// @brief Stores one syntax-only keyword block and its following data rows.
|
||||
struct KeywordBlock {
|
||||
std::string canonical_name;
|
||||
std::string original_line;
|
||||
std::vector<KeywordParameter> parameters;
|
||||
std::vector<DataLine> data;
|
||||
SourceLocation location;
|
||||
};
|
||||
|
||||
/// @brief Stores the parsed syntax and stable identity of one Abaqus input
|
||||
/// file.
|
||||
struct ParsedInput {
|
||||
std::filesystem::path source_path;
|
||||
std::string source_content_identity;
|
||||
std::vector<KeywordBlock> blocks;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_IO_ABAQUS_INPUT_SYNTAX_H_
|
||||
@@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/core/source_identity.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace fesa {
|
||||
|
||||
// Names are canonicalized for syntax lookup while values remain source text.
|
||||
struct KeywordParameter {
|
||||
std::string name;
|
||||
std::optional<std::string> value;
|
||||
};
|
||||
|
||||
struct DataLine {
|
||||
std::vector<std::string> fields;
|
||||
SourceLocation location;
|
||||
};
|
||||
|
||||
struct KeywordBlock {
|
||||
std::string canonicalName;
|
||||
std::string originalLine;
|
||||
std::vector<KeywordParameter> parameters;
|
||||
std::vector<DataLine> data;
|
||||
SourceLocation location;
|
||||
};
|
||||
|
||||
struct ParsedInput {
|
||||
std::filesystem::path sourcePath;
|
||||
std::string sourceContentIdentity;
|
||||
std::vector<KeywordBlock> blocks;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef FESA_IO_HDF5_HDF5_RESULTS_WRITER_H_
|
||||
#define FESA_IO_HDF5_HDF5_RESULTS_WRITER_H_
|
||||
|
||||
#include "fesa/results/results_writer.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
/// @brief Writes authoritative schema-v0 HDF5 results atomically.
|
||||
/// @note HDF5 and platform types remain private to the implementation.
|
||||
class Hdf5ResultsWriter final : public ResultsWriter {
|
||||
public:
|
||||
/// @brief Writes and self-checks a complete candidate before finalization.
|
||||
/// @param output_path Final authoritative path; the candidate is created in
|
||||
/// the same directory.
|
||||
/// @param domain Immutable source and model identity.
|
||||
/// @param state Fully recovered analysis state.
|
||||
/// @param diagnostics Deterministically ordered run diagnostics.
|
||||
/// @return Success only after atomic replacement or a structured output
|
||||
/// failure.
|
||||
/// @note A failed candidate does not replace an existing valid final file.
|
||||
Status Write(const std::filesystem::path& output_path, const Domain& domain,
|
||||
const AnalysisState& state,
|
||||
const std::vector<Diagnostic>& diagnostics) override;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
|
||||
#endif // FESA_IO_HDF5_HDF5_RESULTS_WRITER_H_
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "fesa/results/results_writer.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
// Writes schema-v0 output while keeping backend and platform types private.
|
||||
class Hdf5ResultsWriter final : public ResultsWriter {
|
||||
public:
|
||||
Status Write(
|
||||
const std::filesystem::path& outputPath,
|
||||
const Domain& domain,
|
||||
const AnalysisState& state,
|
||||
const std::vector<Diagnostic>& diagnostics) override;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
Reference in New Issue
Block a user