Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs-feliks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Feliks Kiszkurno
ogs-feliks
Commits
f72bebc2
Commit
f72bebc2
authored
6 years ago
by
Tom Fischer
Committed by
Lars Bilke
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[GO2OGS] Impl. of Layer.
parent
838756a6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Applications/FileIO/GocadIO/Layer.cpp
+61
-0
61 additions, 0 deletions
Applications/FileIO/GocadIO/Layer.cpp
Applications/FileIO/GocadIO/Layer.h
+38
-0
38 additions, 0 deletions
Applications/FileIO/GocadIO/Layer.h
with
99 additions
and
0 deletions
Applications/FileIO/GocadIO/Layer.cpp
0 → 100644
+
61
−
0
View file @
f72bebc2
/**
*
* @copyright
* Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/LICENSE.txt
*/
#include
<algorithm>
#include
<iterator>
#include
<sstream>
#include
<logog/include/logog.hpp>
#include
"Layer.h"
namespace
FileIO
{
namespace
Gocad
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Layer
const
&
l
)
{
std
::
copy
(
l
.
regions
.
begin
(),
l
.
regions
.
end
(),
std
::
ostream_iterator
<
Gocad
::
Region
>
(
os
,
" "
));
return
os
;
}
Layer
parseLayer
(
std
::
string
const
&
line
,
std
::
vector
<
Gocad
::
Region
>
const
&
regions
)
{
std
::
istringstream
iss
(
line
);
std
::
istream_iterator
<
std
::
string
>
it
(
iss
);
// Check first word is MODEL_LAYER.
if
(
*
it
!=
std
::
string
(
"MODEL_LAYER"
))
{
ERR
(
"Expected MODEL_LAYER keyword but '%s' found.
\n
"
,
it
->
c_str
());
throw
std
::
runtime_error
(
"In parseRegion() expected MODEL_LAYER keyword not found.
\n
"
);
}
++
it
;
Layer
l
;
while
(
it
!=
std
::
istream_iterator
<
std
::
string
>
()
&&
*
it
!=
"END"
)
{
auto
const
&
region_it
=
std
::
find_if
(
regions
.
begin
(),
regions
.
end
(),
[
&
](
Gocad
::
Region
const
&
r
)
{
return
r
.
name
==
*
it
;
});
if
(
region_it
!=
regions
.
end
())
{
l
.
regions
.
push_back
(
*
region_it
);
}
++
it
;
}
return
l
;
}
}
// end namespace Gocad
}
// end namespace FileIO
This diff is collapsed.
Click to expand it.
Applications/FileIO/GocadIO/Layer.h
0 → 100644
+
38
−
0
View file @
f72bebc2
/**
*
* @copyright
* Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/LICENSE.txt
*/
#pragma once
#include
<string>
#include
<vector>
#include
"Region.h"
namespace
FileIO
{
namespace
Gocad
{
// Each model layer own several regions.
struct
Layer
final
{
std
::
vector
<
Region
>
regions
;
bool
hasRegion
(
Region
const
&
r
)
const
{
return
(
std
::
find
(
regions
.
begin
(),
regions
.
end
(),
r
)
!=
regions
.
end
());
}
};
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Layer
const
&
l
);
Layer
parseLayer
(
std
::
string
const
&
line
,
std
::
vector
<
Gocad
::
Region
>
const
&
regions
);
}
// end namespace Gocad
}
// end namespace FileIO
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment